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 }

 

相关文章:

  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-20
  • 2022-02-21
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案