-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstructureExam.cpp
More file actions
47 lines (40 loc) · 836 Bytes
/
structureExam.cpp
File metadata and controls
47 lines (40 loc) · 836 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
47
#include<iostream>
using namespace std;
struct student{
string name;
int age;
};
struct teacher {
string name;
student arr[5];
};
void setMethod(teacher * arr,int n){
arr->name;
arr->arr->name;
arr->arr->age;
while(n>0){
cout<<"please enter your name"<<endl;
cin>>arr->name;
int j=5;
while(j>0){
cout<<"please enter student name"<<endl;
cin>>arr->arr->name;
cout<<"please enter student age"<<endl;
cin>>arr->arr->age;
j--;
}
n--;
}
}
void print(teacher *arr,int n){
for(int i=0;i<n;i++){
cout<<arr[i].name<<endl;
cout<<arr[i].arr->name<<endl;
}
}
int main(){
teacher arr[3];
int length =3;
setMethod(arr,length);
print(arr,length);
}