大家好,帮我看看这道程序题错在哪?

来源:百度知道 编辑:UC知道 时间:2024/06/15 14:58:33
定义一个学生类(Student),数据成员包括:姓名,学号,数学和英语的成绩、用重载运算符“<<”和“>>”实现学生类对象的直接输入和输出。增加转换函数,实现姓名和总成绩的转换。设计一个完整的程序,实现成员函数和重载运算符的正确性。
#include <iostream>
#include <cmath>
using namespace std;

class Student{
char name[10];
int number;
int mathe;
int eng;
public:
friend ostream& operator<<(ostream&,Student&);
friend istream& operator>>(istream&,Student&);
};

ostream& operator<<(ostream& os,Student& p)
{os<<p.name<<p.number<<p.mathe<<p.eng;}

istream& operator>>(istream& is,Student& p)
{is>>p.name>>p.number>>p.mathe>>p.eng;}

int main(void)
{int a;
cin>>"请输入学生人数";
cin>>a;
cout<<"请输入\n"<<"学生姓名"<<" "<<"学号"<<" "<<"数学成绩"<<" "<<"英语成绩&q

#include <iostream>
#include <cmath>
using namespace std;
class Student;
ostream& operator<<(ostream&,Student&);
istream& operator>>(istream&,Student&);
class Student{
char name[10];
int number;
int mathe;
int eng;
public:
friend ostream& operator<<(ostream&,Student&);
friend istream& operator>>(istream&,Student&);
};

ostream& operator<<(ostream& os,Student& p)
{os<<p.name<<p.number<<p.mathe<<p.eng;
return os;}

istream& operator>>(istream& is,Student& p)
{is>>p.name>>p.number>>p.mathe>>p.eng;
return is;}

int main(void)
{int a;
cin>>"请输入学生人数";
cin>>a;
cout<<"请输入\n"<<"学生姓名"<<" "<<"学号"<<" "<<"数学成绩"<<" "<