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 
 6 int main(int argc, char** argv) {
 7     struct Student
 8     {
 9         int num;
10         string name;
11         char sex;
12         float score;
13     };
14     Student stu;
15     Student *p=&stu;
16     stu.num=10010;
17     stu.name="Wang";
18     stu.sex='f';
19     stu.score=99.9;
20     
21     cout<<stu.num<<" "<<stu.name<<" "<<stu.sex<<" "<<stu.score<<endl;
22     cout<<(*p).num<<" "<<(*p).name<<" "<<(*p).sex<<" "<<(*p).score<<endl;
23     
24     return 0;
25 }

 

相关文章:

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