有关类的编程

#include <iostream>
#include <string>
using namespace std;
void main()
{
 struct student
 {
  int num;
  char name[20];
        float score1;
  float score2;
  float score3;
 }stu[5];
 int i;
 float sum1=0,sum2=0,sum3=0;
 cout<<"请输入五个学生的信息(按学号,姓名,三门成绩的顺序)"<<endl;
 for(i=0;i<5;i++)
    cin>>stu[i].num>>stu[i].name>>stu[i].score1;
    cin>>stu[i].score2>>stu[i].score3>>endl;
 for(i=0;i<5;i++)
 {  sum1=stu[i].score1;
    sum2=stu[i].score2;
    sum3=stu[i].score3;
 }
 sum1=sum1/5;
 sum2=sum2/5;
 sum3=sum3/5;
 cout<<"每门的平均分为"<<endl;
 cout<<"第一门:"<<sum1<<" "<<"第二门:"<<sum2<<" "<<"第三门:"<<sum3<<endl;
}

为什么会出现:


error C2679: binary '>>' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion)

wendy0512
浏览 1262回答 2
2回答

wendy0512

谢谢你
打开App,查看更多内容
随时随地看视频慕课网APP