C++结构体指针
·
a
#include<iostream>
#include<string>
using namespace std;
struct yuangong //定义结构体内部变量
{
string xingming;
int xingzi;
int gongzuoshichang;
};
int main()
{
struct yuangong stu1 = { "赵六",14,57 };//结构体数据输入
struct yuangong* p = &stu1; //录入指针
cout << p->xingming << endl;
cout << p->xingzi << endl;
cout << p->gongzuoshichang << endl;
system("pause");
return 0;
}
更多推荐


所有评论(0)