注册 登录
编程论坛 C++ Builder

运行后如何对stu1和stu2进行赋值

wanden_zhuo 发布于 2012-03-27 16:35, 1418 次点击
#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 stu1,stu2;
int main()
{stu1.setdata();
stu2.setdata();
stu1.display();
stu2.display();
return 0;
}
求运行后如何对stu1和stu2进行赋值呀????
2 回复
#2
wanden_zhuo2012-03-27 22:29
哎呀!自己傻逼啦!弄好了
#3
菜鸟,求帮忙2015-07-12 14:52
确实有点
1