应该是这个意思吧
程序代码:
程序代码:#include<iostream>
using namespace std;
typedef struct Student
{
int iScore;
char cName[20];
Student():iScore(0)
{
memset(cName, '\0', sizeof(cName));
}
}STUDENT;
int main()
{
FILE* fp = NULL;
STUDENT student[10];
for(int i = 0; i < 10; i++)
{
student[i].iScore = rand()%101;
}
fp = fopen("student.txt", "w+");
if(fp == NULL)
{
printf("file open fail\n");
}
for(i = 0; i < 10; i++)
{
fprintf(fp,"%d ", student[i].iScore);
}
fprintf(fp,"#");
fclose(fp);
return 0;
}



