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 }