-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStruct,union,enum.cpp
More file actions
45 lines (38 loc) · 827 Bytes
/
Struct,union,enum.cpp
File metadata and controls
45 lines (38 loc) · 827 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
#include<iostream>
using namespace std;
typedef struct employee
{
/* data */
int eId; //4
char favChar; //1
float salary; //4
} ep;
union money
{
/* data */
int rice; //4
char car; //1
float pounds; //4
};
int main(){
enum Meal{ breakfast, lunch, dinner};
Meal m1 = lunch;
cout<<(m1==2)<<endl;
// cout<<breakfast;
// cout<<lunch;
// cout<<dinner;
// union money m1;
// m1.rice = 34;
// m1.car = 'c';
// cout<<m1.car;
ep harry;
// struct employee shubham;
// struct employee rohanDas;
harry.eId = 1;
// harry.favChar = 'c';
// harry.salary = 120000000;
cout<<"The value is "<<harry.eId<<endl;
// cout<<"The value is "<<harry.favChar<<endl;
// cout<<"The value is "<<harry.salary<<endl;
return 0;
}