小白求助,求如何解决图中的问题
程序代码:
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ FILE *fp6; char str[20]; int age,i; float sum; if ((fp6=fopen("datafile.txt","w"))=NULL){ printf("File can't be opened !"); exit(1); } printf("type str:"); for (i=0;i<19;i++) scanf("%c",&str[i]); printf("type age,sum:"); scanf("%d%f",&age,&sum); while (strlen(str)>1){ fprintf(fp6,"%s%d%f",str,age,sum); printf("type str,age,sum"); scanf("%s%d%f",str,&age,&sum); } fclose(fp6); return 0; }