各位高人,这个C++程序哪个地方不对啊?怎么只能输入一组数据啊?
#include <iostream>using namespace std;
class Student
{private:
int num;
int score;
public:
void setdata()
{
cin>>num;
cin>>score;
}
void display()
{
cout<<"num="<<num<<endl;
cout<<"score="<<score<<endl;
}
};
Student stud1,stud2;
int main()
{
stud1.setdata();
stud2.setdata();
stud1.display();
stud2.display();
return 0;
}