-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut14.cpp
63 lines (52 loc) · 1010 Bytes
/
tut14.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Structures , Unions & Enums in C++
#include <iostream>
using namespace std;
// struct employee
// {
// int eid;
// char favchar;
// float salary;
// };
typedef struct employee
{
/* data */
int eid; // 4
char favchar; // 1
float salary; // 4
} ep;
union money
{
int rice;
char car;
float pounds;
};
enum Meal
{
breakfast,
lunch,
dinner
};
int main()
{
// struct employee harry;
ep harry;
// struct employee shubham;
// struct employee rohandas;
harry.eid = 1;
harry.favchar = 's';
harry.salary = 120000000;
cout << "The value is " << harry.eid << endl;
cout << "The value is " << harry.salary << endl;
cout << "The value is " << harry.favchar << endl;
// union money m1;
// m1.rice = 34;
// m1.car = 'c';
// cout<<m1.car<<endl;
// enum Meal m1 = lunch;
Meal m1 = lunch;
cout << (m1 == 1);
// cout<<breakfast;
// cout<<lunch;
// cout<<dinner;
return 0;
}