-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11struct.cpp
More file actions
41 lines (33 loc) · 881 Bytes
/
Copy path11struct.cpp
File metadata and controls
41 lines (33 loc) · 881 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
#include<iostream>
using namespace std;
//structure is used to create many datatypes for single use
struct employee
{
int ID;
char favChar;
float salary;
};
//you can use typedef to make a short form for the struct (name)
typedef struct student
{
int Rno;
char group;
int div;
}sd;
int main(){
struct employee vasu;
vasu.ID = 317;
vasu.favChar = 'a';
vasu.salary = 1200000;
cout<<"The value of vasu's ID is "<<vasu.ID<<endl;
cout<<"The value of vasu's favChar is "<<vasu.favChar<<endl;
cout<<"The value of vasu's salary is "<<vasu.salary<<endl;
sd aenansh;
aenansh.Rno = 231030317;
aenansh.group = 'A';
aenansh.div = 110;
cout<<"Aenansh's roll no. is "<<aenansh.Rno<<endl;
cout<<"Aenansh's group is "<<aenansh.group<<endl;
cout<<"Aenansh's division is "<<aenansh.div<<endl;
return 0;
}