-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice.cpp
More file actions
53 lines (44 loc) · 1.01 KB
/
Copy pathpractice.cpp
File metadata and controls
53 lines (44 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<iostream>
using namespace std;
struct person
{
char name[30];
int age;
float salary;
};
void display(int n, struct person);
struct person details(int n , struct person);
struct person details(int n , struct person p[])
{
int i;
for(i = 0; i < n; i++)
{
cout<<"Enter name of person "<<i+1<<" => ";
cin>>p[i].name;
cout<<"Enter age of person "<<i+1<<" => ";
cin>>p[i].age;
cout<<"Enter salary of person "<<i+1<<" => ";
cin>>p[i].salary;
}
return p[n];
}
void display(int n ,struct person p[])
{
int i;
cout<<"Display the details: "<<endl;
for(i = 0; i < n; i++)
{
cout<<"Name of "<<i+1<<" person => "<<p[i].name<<endl;
cout<<"Age of "<<i+1<<" person => "<<p[i].age<<endl;
cout<<"Salary of "<<i+1<<" person => "<<p[i].salary<<endl;
}
}
int main()
{
int n;
cout<<"Enter the number of persons => "<<endl;
cin>>n;
struct person g[n];
g[n] = details(n ,g);
display(n ,g);
}