-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathData_Types.cpp
More file actions
54 lines (46 loc) · 1.38 KB
/
Data_Types.cpp
File metadata and controls
54 lines (46 loc) · 1.38 KB
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
/* Name - Mayank yadav
Class - ENTC A
PRN - 24070123060 */
#include <iostream>
#include <string>
using namespace std;
int main() {
int a;
cout << "Enter any integer:";
cin >> a;
cout << "Integer =" << a << " and size is: " << sizeof(a) << "bytes" << endl;
float b;
cout << "Enter any number with decimal:";
cin >> b;
cout << "Float =" << b << " and size is: " << sizeof(b) << "bytes" << endl;
double d;
cout << "Enter any number:";
cin >> d;
cout << "Double =" << d << " and size is: " << sizeof(d) << "bytes" << endl;
char c;
cout << "Enter any character:";
cin >> c;
cout << "Character =" << c << " and size is: " << sizeof(c) << "bytes" << endl;
string s;
cout << "Enter any string:";
cin >> s;
cout << "String =" << s << " and size is: " << sizeof(s) << "bytes" << endl;
bool printTrue = true;
bool printFalse = false;
cout << printTrue<<endl;
cout << "Size of bool is =" << sizeof(printTrue)<<"bytes";
return 0;
}
/* OUTPUT:
Enter any integer:10
Integer =10 and size is: 4bytes
Enter any number with decimal:10.07
Float =10.07 and size is: 4bytes
Enter any number:10072005
Double =1.0072e+07 and size is: 8bytes
Enter any character:M
Character =M and size is: 1bytes
Enter any string:MayankYadav
String =MayankYadav and size is: 32bytes
1
Size of bool is =1bytes */