📄 demo_struct_09.cpp
字号:
//******************************
//** struct_09.cpp **
//******************************
# include <iostream.h>
struct Person
{
char name[20];
unsigned long id;
float salary;
};
void GetPerson(Person& p)
{
cout<<"Please enter a name for one person: \n";
cin>>p.name;
cout<<"Please enter one's id number and his salary: \n";
cin>>p.id>>p.salary;
}
void Print(Person& p)
{
cout<<p.name<<" "
<<p.id<<" "
<<p.salary<<endl;
}
void main()
{
Person employee[3];
for(int i=0;i<3;i++)
{
GetPerson(employee[i]);
Print(employee[i]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -