新微赢技术网

标题: [求助]程序出错了 [打印本页]

作者: 大漠    时间: 2009-11-3 01:44
标题: [求助]程序出错了
#include <iostream.h>
#include <string.h>
class Student
{
private :
char name [20];
char id[8];
int score[5];
public:
Sudent (char *iid="",char *s="")
{
strcpy(id,iid);
strcpy(name,s);};
float GetAvg();
float GetMax();
void Print();
friend istream& operator >>(istream& istr,Student&);
};
istream& operator>>(istream& istr,Student& c)
{ cout<<"请输入学号" <<endl;
cin>>c.id<<endl;
cout<<"请输入姓名" <<endl;
cin>>c.name;
for (int i=0;i<5;i++)
{
cout<<"请输入学生5门可的成绩"; cin<<c.score[i]<<endl;
}
return istr;
}
float Student:: GetAvg()
{
flaot avg=0.0;
for (int i=0,i<5,i++)
{
avg+=scr[i];
}
reutrn avg/5.0;
}
float Student::GetMax()
{int max=0;
for(int i=0;i<5;i++)
if(max<scr[i])
{
max=scr[i];
}
return max;
}
void Student::Print()
{
cout<<"学生的学号是:"<<id<<endl;
cout<<"学生的姓名是:"<<name<<endl;
for (int i=0;i<5;i++)
{cout<<str[i];}
}
viod main()
{
Student c
cin>>c;
c.print();
cout<<"平均成绩:"<<c.GetAvg()<<endl;
cout<<"最高成绩:"<<c.GetMax()<<endl;
}
帮忙修改下啊




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2