-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8.10.cpp
More file actions
32 lines (31 loc) · 870 Bytes
/
8.10.cpp
File metadata and controls
32 lines (31 loc) · 870 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
/*Write a program that declares a structure Teacher to store Teacher_ID, Teacher_Name, and salary. The program defines an array
of structure to store the records of four teachers. It inputs the records of four teachers. Then program inputs a Teacher_ID from
user and searchb the teacher and show it record.*/
#include<iostream>
using namespace std;
struct T{
int id,salary;
char name[100];
}arr[4];
int main(){
for(int i=0; i<4; i++){
cout<<endl<<"Enter ID :";
cin>>arr[i].id;
cout<<endl<<"Enter Salary :";
cin>>arr[i].salary;
cout<<endl<<"Enter Name :";
cin>>arr[i].name;
}
int index,in;
cout<<"Enter id :";
cin>>in;
in--;
for(int i=0; i<=3; i++){
if(in=arr[i].id)
index=i;
}
cout<<endl<<"ID :"<<arr[index].id;
cout<<endl<<"Salary :"<<arr[index].salary;
cout<<endl<<"Name :"<<arr[index].name;
return 0;
}