填空题已知字母A的ASCII码为65,以下程序运行后的输出结果是{{U}} 【8】 {{/U}}。
main()
{ char a, b;
a='A'+'5'-'3'; b=a+'6'-'2';
printf("% d % c/n", a, b);
}
填空题用复合的赋值运算符将变量x中的值增大2的赋值表达式是
________
。
填空题下列给定程序是建立一个带头结点的单向链表,并用随机函数为各结点数据域赋值。函数fun()的作用是求出单向链表结点(不包括头结点)数据域中的最大值,并且作为函数值返回。 请改正程序中的错误,使它能得出正确的结果。 注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。 试题程序: #include <stdio.h> #include <conio.h> #include <stdlib.h> typedef struct aa int data; struct aa *next; NODE; /*************found**************/ fun (NODE *h) int max=-1; NODE *p; p=h->next; while(p) if(p->data>max) max=p->data; /*************found**************/ p=h->next; return max; outresult(int s, FILE *pf) fprintf(pf, "/nThe max in link :%d/n ",s); NODE *creatlink(int n, int m) NODE *h,*p,*s,*q; int i, x; h=p=(NODE *)malloc(sizeof(NODE)); h->data=9999; for(i=1;i<=n;i++) s=(NODE *) malloc(sizeof(NODE)); s->data=rand()%m; s->next=p->next; p->next=s; p=p->next; p->next=NULL; return h; outlink(NODE *h,FILE *pf) NODE *p; p=h->next; fprintf(pf, "/n The LIST :/n/n HEAD"); while(p) fprintf(pf, "->%d",p->data); p=p->next; fprintf(pf, "/n"); main ( ) NODE *head; int m; clrscr(); head=creatlink(12,100); outlink(head,stdout); m=fun(head); printf("/nThe RESULT :/n"); outresult (m, stdout);
填空题下列给定程序中函数fun()的功能是:将tt所指字符串中的小写字母全部改为对应的大写字母,其他字符不变。
例如,若输入“Ab, cD”,则输出“AB, CD”。 请在标号处填入正确的内容,使程序得出正确的结果。
注意:不要改动main()函数,不得增行或删行,也不得更改程序的结构。
试题程序 #include
<conio.h> #include <stdio.h> #include
<string.h> char*fun(char tt[]) { int
i; for(i=0; tt[i]; i++)
if((tt[i]______'a')______ (tt[i]______'z'))
tt[i]-=32; return (tt); }
main() { char tt[81]; printf("/nPlease enter a
string:"); gets(tt); printf("/nThe result
string is: /n% s",fun(tt)); }
填空题以下程序运行后的输出结果是 【7】 。 #include <stdio.h> main() char m; m='B'+32; printf("%c/n",m);
填空题以下程序运行时输入12↙,输出结果是______。
#include<stdio.h>
int main()
{
char ch1, ch2; int n1, n2;
ch1=getehar(); ch2=getchar();
n1=ch1-"0";
n2=n1*10+(ch2-"0");
printf("%d/n", n2);
return 0;
}
填空题41. 数据结构分为逻辑结构与存储结构,线性链表属于{{U}} {{/U}}。
填空题在算法的4个特征中,算法必须能在执行有限个步骤之后终止,指的是算法的______性。
填空题以下程序运行后的输出结果是______。 #include <stdio.h> main() int a=1,b=7; do b=b/2;a+=b; while (b>1); printf("%d/n",a);)
填空题以下程序的功能是:删去一维数组中所有相同的数,使之只剩一个。数组中的数已按由小到大的顺序排列,函数返回删除后数组中数据的个数。 例如,若一维数组中的数据是: 2 2 2 3 4 4 5 6 6 6 6 7 7 8 9 9 10 10 10 删除后,数组中的内容应该是: 2 3 4 5 6 7 8 9 10。 请填空。 #include<stdio.h> #define N 80 in fun(int a[],int n) int i,j=1; for(i=1;i<n;i++) if(a[j-1] 【12】 a[i]) a[j++]=a[i]; 【13】 ; main() int a[N]=2,2,2,3,4,4,5,6,6,6,6,7,7,8,9,9,10,10,10,i,n=19; printf("The original data:/n"); for(i=0;i<n;i++)printf("%3d",a[i]); n=fun(a,n); printf("/nThe data after deleted :/n"); for(i=0;i<n;i++)printf("%3d",a[i]);printf("/n/n");
填空题有以下程序:
main()
{ int a[]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, *p;
for(p=a; p<a+10; p++)printf("% d,", *p);
}
程序运行后的输出结果是{{U}} 【10】 {{/U}}。
填空题执行下列语句int a=8; a+=a-=a*a; 后,a的值是__________ 。
填空题以下程序的输出结果是{{U}} 【11】 {{/U}}。
main()
{ int s,i;
for(s=0,i=1;1<3;i++,s+=i);
printf("%d/n",s);
}
填空题若有定义:int k;,则以下程序段的输出结果是______。 for(k=2;k<6;k++,k++) printf("##%d",k);
填空题已定义char ch='$';int i=1,j;,执行j!=ch&&i++以后,i的值为{{U}} 【11】 {{/U}}。
填空题若输入3、4、5,程序的输出结果为 【6】 。 #include "math.h" main ( ) float a, b, c, s, area; scanf("%f,%f,%f", s=1.0/2*(a+b+c); area=sqrt (s* (s-a) * (s-b) * (s-c)); printf ("a=%7.2f,b=%7.2f, c=%7.2f, s=%7.2f", a,b, c, s); printf ("area=%7.2f/n", area);
填空题下面的程序通过函数average计算数组中各元素的平均值,请填空。 float avetage(int * pa,int n) int i; float avg=0.0; for(i=0;i<n;i+ +); avg=avg+ 【12】 ;avg= 【13】 ; return avg; main() int i,a[5]=2,4,6,8,10,; float mean; prinf("% mean=% f/n",mean);
填空题以下程序的输出结果是______。
main()
{ int y=9;
for(;y>0;y--)
if(y%3==0)
{printf("%d",--y);continue;}}
填空题下面程序的功能是:将N行N列二维数组中每一行的元素进行排序,第0行从小到大排序,第1行从大到小排序,第2行从小到大排序,第3行从大到小排序,例如:#defineN4voidsort(inta[][N]){inti,j,k,t;for(i=0;ia[i][k]){t=a[i][j];a[i][J]=a[i][k];a[i][k]=t;}}voidoutarr(inta[N][N]){……}main________{intaa[N][N]={{2,3,4,1},{8,6,5,7},{11,12,10,9},{15,14,16,13}};outarr(aa);/*以矩阵的形式输出二维数组*/sort(aa);outarr(aa);}
填空题E-mail地址由用户名和域名两部分组成,这两部分的分隔符为 【3】 。