#include <iostream>
#include <string>
using namespace std;
class student
{
string name;
int num,score;
public:
student(string n,int nu,int s)
{
name=n;
num=nu;
score=s;
}
void get()
{
cout<<"姓名:"<<name
<<"学号:"<<num
<<"成绩:"<<score<<endl;
}
}
main()
{
string xm;
int xh,cj;
cout<<"请登记姓名学号成绩"<<endl;
cin>>xm>>xh>>cj;
student st(xm,xh,cj);
st.get();
}
输入 gxh 22 100
输出 姓名: gxh学号:22成绩: 100
刚学c++编程可能有点不规范。。见谅不知道楼主是不是要这种