填空题下列程序运行后的输出结果是______。 #include<stdio.h> main() char s[20]; scanf("%s",s); printf("%s",s); 运行程序,输入HOW ARE YOU。
填空题下列给定的程序中,fun函数的功能是:将p所指的字符串中每个单词的最后一个字母改成大写(这里的“单词”是指有空格隔开的字符串)。
例如,若输入:“I am a student to take the examination”,
则应输出:“I aM A studenT tO takE thE examinatioN”。
请改正程序中的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#include<ctype.h>
#include<stdio.h>
void fun(char*p)
{
int k=0;
for(;*p;p++)
if(k)
{
/**********found**********/
if(p=="")
{
k=0;
/**********found**********/
*p=toupper(*(p-1));
}
}
else
k=1;
}
void main()
{
char chrstr[64];
int d;
system("CLS");
printf("/nPlease enter an English sentence within 63 letters:");
gets(chrstr);
d=strlen(chrstr);
chrstr[d]="";
chrstr[d+1]=0;
printf("/nBefore changing:/n%s",chrstr);
fun(chrstr);
printf("/nAfter changing:/n%s",chrstr);
}
填空题以下程序的输出结果是{{U}} {{/U}}。 # define MCNA(m)2*m # define MCNB(n, m)2*MCRA(n)+m # define f(x)(x*x) main() int i=2, j=3; printf("% d//n", MCRB(j, MCRA(i)));
填空题以下函数用以求x的y次方。请填空。
double fun(double x, int y)
{ int i; double z=1.0;
for(i=1; i______; i++) z=______;
return z;
}
填空题以下程序运行后的输出结果是{{U}} 【10】 {{/U}}。
main()
{char c1,c2;
for(c1='O',c2='9';c1<c2;c1++,c2-) printf("%c%c",c1,c2);
printf("/n");
}
填空题以下程序运行后的输出结果是 【7】 。 #include <stdio.h> #define S(x) 4 * x * x + 1 main( ) int i=6,j=8; prinff("% d / n" , S( i + j) );
填空题下面程序的功能是调用sub函数计算数组a中字符串的长度,请填空。 sub(char s[]) int n; for(n=0; 【18】 n++); return 【19】 ; main() char*a;int k; gets(a); 【20】 printf("%d",k);
填空题结构类型定义中的成员列表给出n个成员的声明,成员可以是基本类型变量、数组、指针,也可以是______。
填空题请补充函数fun(),该函数的功能是:把ASCⅡ码为偶数的字符从字符串s打中删除,结果仍然保存在字符串srt中,字符串str从键盘输入,其长度作为参数传入函数fun()。 例如,输入“abcdef”,输出“ace”。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。 试题程序: #inc lude< stdio, h> #define N 80 【1】 int i, j; 【2】 for (i=0;i<n;i++) if (s [i] %2!=0) s [j++]=s [i]; 【3】 ; main ( ) int i=0, strlen=0; char str[N]; clrscr (); printf ("/nInput a string:/n"); gets (str); while (str [i] !=' /0' ) strlen++; i++; fun (str, strlen); printf("/n*** display string ***/n"); puts (str);
填空题以下程序的输出结果是______。 #include<stdio.h> #include<string.h> char*fun(char*t) char*P=t; return(p+strlen(t)/2); main() char*str="abcdefgh"; str=fun(str); puts(str);
填空题下面程序和运行运行结果是【 】。
void swap(int * a,int * b)
{ int * t;
t=a; a=b; b=t;
}
main( )
{ intx=3,y=5,* p=&x,* q=&y;
swap(p,q);
prinff("%d %d\n", *p, *q);}
填空题请补充main函数,该函数的功能是:输出一个3×3的矩阵,要求必须使用行指针表示输出变量。
注意;部分源程序给出如下.
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<s tdio. h>
main()
{
static int array[3] [3]={{9,8,7}, {6,5,
4}, (3,2,1}};
iht (*p) [3],j,i;
p={{U}}【1】{{/U}}
clrscr ();
for (i=0; i<3; i++)
{
printf (" /n/n" );
for (j=0; j<3; j++)
printf("%4d",{{U}} 【2】{{/U}} );
}
}
填空题以下程序的输出结果是______。 main() int a=177; printf("%o/n",a);
填空题请补充main函数,该函数的功能是:从键盘输入一个字符串并保存在字符str1中,把字符串str1中下标为偶数的字符保存在字符串str2中并输出。例如,当str1=“cdefghij”,则 str2=“cegi”。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio.h>
#include<conio.h>
#define LEN 80
main()
{
char str1[LEN],str2 [LEN];
char *p1=str1,*p2=str2;
int i=0,j=0;
clrscr();
printf("Enter the string:/n");
scanf({{U}} {{U}} {{/U}} {{/U}});
printf("***the origial string***/n");
while(*(p1+j))
{
printf("{{U}} {{U}} {{/U}} {{/U}}",*(p1+j));
j++;
}
for(i=0;i<j;i+=2)
*p2++=*(str1+i);
*p2='/0';
printf("/nThe new string is:%s/n",{{U}} {{U}} {{/U}} {{/U}});
}
填空题为了建立如图所示的存储结构(即每个结点含两个域,data是数据域,next是指向结点的指针域)。请填空。structlinkchardata;【19】;node;
填空题若输入字符串;abcde,则以下while循环体将执行【12】次。while((ch=getchar())=='e')printf("*");
填空题给定程序中,函数fun的功能是求矩阵(二维数组)a[N][N]中每行的最小值,结果存放到数组b中。假如:若则结果应为1,5,9,13,请改正函数fun中指定部位的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:#include<stdio.h>#defineN4voidfun(inta[][N],intb[]){inti,j;for(i=0;i<N;i++){/*********found*********/b[i]=a[0][0];/*********found*********/for(j=1;j<N-1;j++)/*********found*********/if(b[i]<a[i][j])b[i]=a[i][j];}}main(){inta[N][N]={{1,4,3,2},{8,6,5,7},{11,10,12,9},{13,16,14,15}},b[N];inti;fun(a,b);for(i=0;i<N;i++)printf("%d,",b[i]);printf("/n");}
填空题以下程序统计从终端输入的字符中大写字母的个数,num[0]中统计字母A的个数,num[1]中统计字母B的个数,其他依此类推。用#号结束输入,请填空。 #include<stdio.h> #include<ctype.h> main() int num[26]=0,i;char c; while((______)!='#') if(isupper(c))num[c-'A']=______; for(i一0;i printf("%c:%d",i+'A',num);
填空题49. 有以下程序; int a=2; int f(int *A) return(*A) ++; main() int s=0; int a=5; s+=f(&A) s+=f(&A) printf("%d//n",s) 执行后的输出结果是{{U}} {{/U}}。
填空题以下程序运行后的输出结果是【6】。
#include
main()
{ int a;
a=(int)((double)(3/2)+0.5+(int)1.99*2);
printf("%d\n",a);
}