-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path3.cpp
38 lines (32 loc) · 785 Bytes
/
3.cpp
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
//WAP to input name, roll no. & age of 3 students using a structure & displays them.
#include<iostream>
using namespace std;
struct student
{
char student_name[50];
int rollno;
int age;
};
int main()
{
int i;
struct student S[3];
for(i=0; i<3; i++)
{
cout << "\nEnter the Student Name: ";
cin >> S[i].student_name;
cout << "Enter Roll No.: ";
cin >> S[i].rollno;
cout << "Enter Age: ";
cin >> S[i].age;
}
cout << "\nStudent Details:-\n ";
for(i=0; i<3; i++)
{
cout << "\nStudent Name: " << S[i].student_name;
cout << "\nRoll No.: " << S[i].rollno;
cout << "\nAge: " << S[i].age;
cout << "\n\n";
}
return 0;
}