#include <fstream>
#include <iostream>
using namespace std;
struct Score
{
char num[13];
char name[14];
int cpp;
int math;
int english;
};
int main()
{
int i,n=0;
Score score[300];
ifstream infile("score.txt",ios::in);
if(!infile)
{
cerr<<"open error!"<<endl;
exit(1);
}
while(!infile.eof())
{
infile>>score[n].num>>score[n].name>>score[n].cpp>>score[n].math>>score[n].english;
++n;
}
infile.close();
for(i=0;i<n-1;i++)
{
cout<<score[i].num<<" "<<score[i].name<<" "<<score[i].cpp<<" "<<score[i].math<<" "<<score[i].english<<endl;
}
return 0;
}
成绩处理
最新推荐文章于 2025-04-03 10:19:14 发布