-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatatypes.cpp
More file actions
48 lines (37 loc) · 1.14 KB
/
datatypes.cpp
File metadata and controls
48 lines (37 loc) · 1.14 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
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int my_int = pow(2, 31) - 1;
cout << "my_int = " << my_int++ << endl;
cout << "my_int = " << my_int << endl;
cout << endl;
unsigned int my_uint = pow(2, 31) - 1;
cout << "my_uint = " << my_uint++ << endl;
cout << "my_uint = " << my_uint << endl;
cout << endl;
float my_float = 2.99792e8;
cout << "my_float = " << my_float << endl;
cout << endl;
char my_char = 'a';
cout << "my_char = " << my_char << endl;
my_char += 1;
cout << "my_char = " << my_char << endl;
cout << endl;
// Booleans
bool my_bool = true;
cout << "my_bool = " << my_bool << endl;
my_bool += 8;
cout << "my_bool = " << my_bool << endl;
my_bool = 0;
cout << "my_bool = " << my_bool << endl;
cout << endl;
// Sizes of datatypes
cout << "Size of bool = " << sizeof(bool) << endl;
cout << "Size of char = " << sizeof(char) << endl;
cout << "Size of int = " << sizeof(int) << endl;
cout << "Size of float = " << sizeof(float) << endl;
cout << "Size of long = " << sizeof(long) << endl;
cout << "Size of long long = " << sizeof(long long) << endl;
return 0;
}