帮忙看下简单的输入输出程序
#include<iostream>#include<string>
# define n 5
using namespace std;
struct student
{
int num;
string name;
int score[3];
};
struct classes
{
student info;
float average;
};
void main()
{
void input(classes s[]);
void output(classes s[]);
classes s[n];
input(s);
output(s);
}
void input(classes s[])
{
int i,j;
cout<<"please input:"<<endl;
for(i=1;i<=n;i++)
{
cin>>s[i].info.num>>s[i].info.name;
for(j=1;j<=3;j++)
cin>>s[i].info.score[j];
}
}
void output(classes s[])
{
int i;
for(i=1;i<=n;i++)
cout<<s[i].info.num<<" "<<s[i].info.name<<" "<<s[i].info.score[1]<<" "<<s[i].info.score[2]<<" "<<
s[i].info.score[3]<<" "<<endl;
}最后的一个号数输不出来
[ 本帖最后由 xiao2 于 2011-3-19 10:08 编辑 ]