-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatatypes_2.cpp
More file actions
57 lines (47 loc) · 878 Bytes
/
Copy pathDatatypes_2.cpp
File metadata and controls
57 lines (47 loc) · 878 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
48
49
50
51
52
53
54
55
56
57
#include <iostream>
struct Demostruct{
int val1;
double val2;
}
typedef struct Demostruct dstruct;
class Demo{
string name;
public:
Demo() {}
Demo(string ip): name(ip) {}
void PrintName{
cout << "Name is:"<< name << endl;
}
};
typedef Demo dem;
}
int main() {
// Primitive DataTypes
int num =10;
int num2;
char ch='a';
bool x=true;
double y=11.10;
float z=12.2;
//Derived DataTypes
int arr[10]={1,2,3,4,5,};
int *ptr = #
int& numRef = num;
// User Defined DataTypes
enum day {
Sunday,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday
};
d day = Sunday;
cout <<"Day is:"<< d<< endl;
dstruct s{0,1};
cout << s.val2<< endl;
dem DemoObject("Hello!!");
DemoObject.PrintName();
return 0;
}