-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.2.cpp
More file actions
46 lines (45 loc) · 981 Bytes
/
2.2.cpp
File metadata and controls
46 lines (45 loc) · 981 Bytes
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
// 2.2 WAP in c++ enter n student records using array of structures
#include <iostream>
using namespace std;
struct student
{
int rollno, fees;
char name[20];
} s[10];
int main()
{
int n;
cout << "How many students: ";
cin >> n;
for (int i = 0; i < n; i++)
{
cout << "Enter rollno, fees, name of student " << i + 1 << endl;
cin >> s[i].rollno >> s[i].fees >> s[i].name;
}
for (int i = 0; i < n; i++)
{
cout << "Data of student " << i + 1 << endl;
cout << "rollno = " << s[i].rollno << endl;
cout << "fees = " << s[i].fees << endl;
cout << "name = " << s[i].name << endl;
}
return 0;
}
// Output:
// How many students:2
// Enter rollno, fees, name of student 1
// 124
// 10000
// ram
// Enter rollno, fees, name of student 2
// 115
// 10000
// shyam
// Data of student 1
// rollno = 124
// fees = 10000
// name = ram
// Data of student 2
// rollno = 115
// fees = 10000
// name = shyam