第7题
输入How are you? <回车> 后,下列程序的输出结果是_______。 (函数strcmp(s, t)的功能:若s 和t 相等,返回0;若s 大于t,返回一个正数;若s 小于t,返回一个负数) #include <stdio.h> #include <string.h> void main( ) { int i; char s[80], ss[80]; scanf("%s", s); strcpy(ss,s); for(i=1; i<3; i++){ scanf("%s", s); if(strcmp(s, ss)> 0) strcpy(ss,s); } printf("%s\n", ss); }
点击查看答案
第9题
下列程序的功能是_______。 #include <stdio.h> # include <stdlib.h> void main() { FILE *fpa, *fpb; if((fpa=fopen("t.c","r")) == NULL){ printf("can not open file a.txt !\n"); exit(0); } if((fpb=fopen("b.txt","w")) == NULL){ printf("can not open file b.txt!\n"); exit(0); } while(!feof(fpa)) fputc(fgetc(fpa), fpb); fclose(fpa); fclose(fpb); }
点击查看答案