-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path18.cpp
42 lines (33 loc) · 910 Bytes
/
18.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
39
40
41
42
//WAP showing implementation of a nested structure & access the data members of both structures.
#include<iostream>
//using namespace std;
using std::cout;
using std::cin;
struct college//Put identifier name after struct
{
char college_name[50];
int college_ID;
};
struct students //Put identifier name after struct
{
char student_name[50];
int student_rollno;
struct college coll;
};
int main()
{
students s;
cout<<"Enter Student Name: ";
cin>>s.student_name;
cout<<"Enter Student Roll No.: ";
cin>>s.student_rollno;
cout<<"Enter College Name: ";
cin>>s.coll.college_name;
cout<<"Enter College ID: ";
cin>>s.coll.college_ID;
cout<<"\nCollege Name: "<<s.coll.college_name;
cout<<"\nCollege ID: "<<s.coll.college_ID;
cout<<"\nStudent Name: "<<s.student_name;
cout<<"\nStudent Roll No.: "<<s.student_rollno;
return 0;
}