返回结构.txt

来自「用于计算多边形的面积,体积,长度, 用于操作系统的开发 用于数据的加密」· 文本 代码 · 共 31 行

TXT
31
字号
#include<iostream.h>
struct Person
{
	char name[20];
	unsigned long id;
	float salary;
};
Person GetPerson()
{
	Person temp;
	cout<<"Please enter a name for one person:\n";
	cin>>temp.name;
	cout<<"Please enter one's id number and his salary:\n";
	cin>>temp.id>>temp.salary;
	return temp;
}
void Print(Person &p)
{
	cout<<p.name<<"  "
		<<p.id<<"  "
		<<p.salary<<endl;
}
void main()
{
	Person employee[3];
	for(int i=0;i<3;i++)
	{
		employee[i]=GetPerson();
		Print(employee[i]);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?