题目内容

将代码补充完整。01 #include 02 #include 0304 int main()05 {06 FILE *fp;07 char ch;08 int counter1 = 0, counter2 = 0;09 if ((fp = fopen("file.c", "r")) == NULL)10 {11 printf("file open error!\n");12 exit(0);13 }14 while (!)15 {16 ch = fgetc(fp);17 if (ch == '{')18 ;19 if (ch == '}')20 ;21 }22 fclose(fp);23 if ()24 printf("OK!\n");25 else26 printf("ERROR!\n");27 return 0;28 }

查看答案
更多问题

请将代码补充完整。01 #include 02 #include0304 #define N 200506 int fun(int []);0708 int main()09 {10 FILE *fp;11 int a[N], i, cnt;12 if ((fp = fopen("test.txt", "r")) == NULL)13 {14 printf("Cannot open the file.\n");15 exit(0);16 }17 for (i = 0; i

请将代码补充完整。01 #include 02 #include 0304 int main()05 {06 FILE *fp1, *fp2;07 if ((fp1 = fopen("file1.txt", "r")) == NULL)08 {09 printf("Cannot open the file.\n");10 exit(0);11 }12 if ((fp2 = fopen("file2.txt", "w")) == NULL)13 {14 printf("Cannot open the file.\n");15 exit(0);16 }17 while ()18 putchar(fgetc(fp1));19 rewind(fp1);20 while (!feof(fp1))21 fputc(fgetc(fp1), fp2);22 fclose();23 fclose();24 return 0;25 }

请将代码补充完整。01 #include0203 #define SIZE 100405 struct Student_type06 {07 int num;08 char name[10];09 int age;10 char addr[15];11 }stud[SIZE];1213 void save();1415 int main()16 {17 int i;18 printf("Please enter data of %d students:\n", SIZE);19 for (i = 0;; ++i)20 scanf("%d%s%d%s", &stud[i].num, stud[i].name, &stud[i].age, stud[i].addr);21 save();22 return 0;23 }2425 void save()26 {27 FILE *fp;28 int i;29 if ((fp =("stu.dat", "wb")) == NULL)30 {31 printf("cannot open file\n");32 return;33 }34 for (i = 0; i

请将代码补充完整。01 #include 02 #include 0304 void fun(int []);0506 int main()07 {08 int a[10];09 int i;10 FILE *fp;11 if ((fp = fopen("c:\\tmp.txt", "w")) == NULL)12 {13 printf("can not open the file\n");14 exit(1);15 }16 fun(a);17 for (i = 0; i<10; i++)18 {19 printf("%4d", a[i]);20 fprintf(, "%4d", a[i]);21 }22 fclose(fp);23 return 0;24 }2526 void fun(int a[])27 {28 int i;29 int cnt = 0;30 for (i = 1; cnt<10; i++)31 {32 if (i % 2 == 1 && i % 3 == 1 &&)33 {34 a[cnt] = ;35 cnt++;36 }37 }38 }

答案查题题库