1 #include <iostream>
2 #include <string.h>
3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
4 using namespace std;
5 class Student
6 {
7 public:
8 void get_value()
9 {
10 cin>>num>>name>>sex;
11 }
12 void display(){
13 cout<<"num:"<<num<<endl;
14 cout<<"name:"<<name<<endl;
15 cout<<"sex:"<<sex<<endl;
16 }
17 private:
18 int num;
19 string name;
20 char sex;
21 };
22
23
24 int main(int argc, char** argv) {
25 Student stud;
26 stud.get_value();
27 stud.display();
28 return 0;
29 }