填空题在Windows环境下,利用菜单命令删除固定硬盘上的文件与文件夹,实际上是将需要删除的文件与文件夹移动到【 】文件夹中。
填空题下列程序运行后的输出结果是______。 #include<stdio.h> main() char s[20]; scanf("%S",S); printf("%s",s); 运行程序,输入HOW ARE YOU。
填空题以下程序的输出结果是{{U}} 【14】 {{/U}}。
#include <stdio.h>
#define MAX(x,y) (x)>(y)? (x):(y)
main()
{ int a=5,b=2,c=3,d=3,t;
t = MAX(a+b,c+d)*10;
printf("%d/n",1);
}
填空题“printf("%d/n",strlen("/t/"023/xABC/n");”语句的输出结果是______。
填空题给定程序中函数fun的功能是:将s所指字符串中位于奇数位置的字符或ASCII码为偶数的字符放入t所指数组中(规定第一个字符放在第0位中)。
例如,字符串中的数据为:AABBCCDDEEFF,则输出应当是:ABBCDDEFF。
请改正函数fun中指定部位的错误,使它能得出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!
给定源程序:
#include<stdio.h>
#include<string.h>
#define N 80
void fun(char*s,char t[])
{int i,j=0;
for(i=0;i<(int)strlen(s);i++)
/**********found**********/
if(i%2
/**********found**********/
t[i]="/0";
}
main()
{char s[N],t[N];
printf("/nPlease enter string s:");gets(s);
fun(s,t);
printf("/nThe result is:%s/n",t);
}
填空题若自定义函数要求返回一个值,则在该函数体中应有一条______语句;若自定义函数要求不返回值,则在该函数说明时加一类型说明符______。
填空题有下列程序: #include <stdio.h> main() char C; while((c= getchar ())!=',') putchar(++c); 程序运行时,如果从键盘输入:A,B,<CR>,则输出结果为______。
填空题下面程序的运行结果是{{U}} 【17】 {{/U}}。
typedef union student
{ char name[10];
long sno;
char sex;
float score[4];
} STU;
main()
{ STU a[5];
printf("%d/n",sizeof(a));
}
填空题有以下程序: #include<stdio.h> fun(int x) if(x/2>0)fun(x/B); printf("%d",x); main() fun(6);printf("/n"); 程序运行后的输出结果是______。
填空题请补充main函数,该函数的功能是:输出一个N×N矩阵,要求非对角线上的元素赋值为0,对角线元素赋值为1。
注意:部分源程序给出如下。
请勿改动主函数main和其他函数中的任何内容,仅在 main函数的横线上填入所编写的若干表达式或语句。
试题程序:
#include<stdio. h>
#define N 10
main ( )
{
int bb[N] [N];
int i, j,n;
clrscr ();
printf (" /nInput n:/n");
scanf ("%d",
for (i=0; i<n; i++)
for (j=0; j<n; j++)
{
{{U}} 【1】 {{/U}};
if (i==j)
bb[i] [j]={{U}} 【2】 {{/U}};
if ({{U}} 【3】 {{/U}})
bb[i] [j]=1;
}
printf(" /n***** the result ***** /n");
for (i=0; i<n; i++)
{
printf (" /n/n");
for (j=0; j<n; j++)
printf ("%4d",bb [i] [j] );
}
}
填空题下面程序的执行结果是 【9】 。 main() int a=5,b=4,c=9; printf("###%d",(a<C) ?c*b:a*B) ;
填空题以下程序运行后输入:3,abcde,则输出结果是{{U}} 【17】 {{/U}} #include <string.h> move(char *str, int n) { char temp; int i; temp=str[n-1]; for(i=n-1;i>0;i--) str[i]=str[i-1]; str[0]=temp; } main( ) { char s[50]; int n, i, z; scanf("%d,%s", z=strlen(s); for(i=1; i<=n; i++) move(s, z); printf("%s/n",s); }
填空题下列给定程序中,函数fun的功能是:比较两个字符串,将长的字符串的首地址作为函数值返回。
请改正程序中的错误,使它能得出正确的结果。
注意
:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include<conio.h>
#include<stdio.h>
/********found********/
double fun(char *s,char *t)
{
int s1=0,t1=0;
char *ss,*tt;
ss=s;
tt=t;
while(*ss)
{
s1++;
/********found********/
(*ss)++;
}
while(*tt)
{
t1++;
/********found********/
(*tt)++;
}
if(t1>s1)
return t;
else.
return s;
}
main()
{
char a[80],b[80];
printf("/nEnter a string:");
gets(a);
printf("/nEnter a string again:");
gets(b);
printf("/nThe longer is:/n/n%s/n",fun (a,b));
}
填空题若有如下程序: main() int x=5,y,*t;t=&x; y=++(* t); printf("%d,%d",x,y); 则程序执行后的x值为 【11】 ,y的值为 【12】 。
填空题下列程序的输出结果是______。 main() int i; for(i=1;i+1;i++) if(i>4) printf("%d/n",i); break; printf("%d/n",i++);
填空题下列给定程序中函数fun的功能是:将m(1≤m≤10)个字符串连接起来,组成一个新串,放入pt所指存储区中。例如,把三个串“abc”、“CD”、“EF”连接起来,结果是“abcCDEF”。
请改正程序中的错误,使它能得出正确的结果。
注意
:不要改动main函数,不得增行或删行,也不得更改程序的结构!
试题程序:
#include <stdio.h>
#include <string.h>
void fun (char str[][10],int re,char *pt)
{
/********found********/
Int k,q,i;
for(k=0;k<m;k++)
{q=strlen(str[k]);
for(i=0;i<q;i++)
/********found********/
pt[i]=str[k,i];
pt+=q;
pt[0]=0;
}
}
main()
{int m,h;
char s[10][10],p[120];
printf("Please enter m:");
scan("%d", gets(s[0]);
printf("Please enter %d string:",m);
for(h=0;h<m;h++)gets(s[h]);
fun(s,m,p);
printf("The result is:%s",p);
}
填空题在对文件进行操作的过程中,若要求文件的位置指针重新指向文件的开头,应当调用的函数是{{U}} 【16】 {{/U}}函数。
填空题以下程序运行后的输出结果是{{U}} 【18】 {{/U}}。
#include <stdio.h>
main()
{ int i,m=0,n=0,k=0;
for(i=9;i<=11;i++)
switch(i/10)
{ case 0: m++;n++;break;
case 10: n++;break;
default: k++;n++;
}
printf("%d%d%d/n",m,n,k);
}
填空题给定程序中函数fun的功能是:从N个字符串中找出最长的那个串,并将其地址作为函数值返回。
各字符串在主函数中输入,并放入一个字符串数组中。所找到的最长字符串在主函数中输出。
请改正程序中的错误,使它能得出正确结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
给定源程序:
#include<stdio.h>
#include<string.h>
#define N 5
#define M 81
/**********found**********/
fun(char(*sq)[M])
{int i;char*sp;
sp=sq[0];
for(i=0;i<N;i++)
if(strlen(sp)<strlen(sq[i]))
sp=sq[i];
/**********found**********/
return sq;
}
main()
{char str[N][M],*longest;int i;
printf("Enter%d lines:/n",N);
for(i=0;i<N;i++)gets(str[i]);
printf("/nThe N string:/n",N);
for(i=0;i<N;i++)puts(str[i]);
longest=fun(str);
printf("/nThe longest string:/n");puts(longest);
}
填空题53. 下述函数统计—个字符串中的单词个数,单词是指处在空格之间的字符序列,请填空。int word(char*s) int num=0,flag=0;while(*s) if({{U}} {{/U}}='') flag=0; else if({{U}} {{/U}})flag=1;num++return{{U}} {{/U}};
