题目内容

将代码补充完整。01 #include 02 #include 0304 int main()05 {06 FILE *fp;07 char str[80];08 int i = 0;09 printf("please enter a string : \n");10 gets_s(str,80);11 if ((fp = fopen("c:\\tmp.txt", "w")) ==)12 {13 printf("can not open the file\n");14 exit(1);15 }16 while () /*正确处理循环条件2分*/17 {18 printf("%c(%d)", str[i], str[i]);19 fprintf(, "%c(%d)", str[i], str[i]);20 i++;21 }22 fclose(fp);23 return 0;24 }

查看答案
更多问题

将代码补充完整。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

答案查题题库