关于C++中的主函数的定义函数问题,新手求助,在线等,大家来帮帮,谢谢了
#include<iostream>using namespace std;#include<string>class Student{public: void input(); void output();private: int num; string name; float cplusplus,math,English;};void Student::input(){ cout <<"学生学号为:"; cin >>num; cout <<"学生名字为:"; cin >>name; cout <<"学生cplusplus,数学,英语成绩分别为:"; cin >>cplusplus >>math >>English;};void Student::output(){ cout <<" "<<num <<" " << name <<" " <<cplusplus <<" " <<math <<" " <<English <<endl;}void check(class Student stu,int i){ int m,n,h=1; while(h==1) {cout <<"需要查询的同学的学号:"; cin >>m; m=m-1; for(n=0;n<i;n++) { if(m==n) {stu[m].output(); cout <<"good"; break; }; if(n==i-1) cout <<"无该学生信息" <<endl; if(m>i) {cout<< "无该学生信息"<<endl; break; } } cout <<"1.继续查找 2.退出" <<endl; cin >> h; }}int main(){ int i,j; //共有多少个学生 cout <<"How many students in total:"; cin >>i; //定义学生的类 Student stu[60]; //输入信息 cout<<endl <<"输入学生信息"<<endl; for(j=0;j<i;j++) { stu[j].input(); cout<<"下一个学生信息"<<endl; }; //输出信息 cout <<"输入学生总体信息为:"<<endl; cout <<" "<<"学号" <<" " <<"名字" <<" " <<"cplusplus" <<" " <<"math" <<" " <<"English" <<endl; for(j=0;j<i;j++) { stu[j].output(); cout<<endl; } //学生信息查询 check(stu,i); return 0;}