-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatatype.cpp
50 lines (44 loc) · 983 Bytes
/
datatype.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
//Aim - Verifying Data Types in CPP
#include <string>
#include <iostream>
using namespace std;
int main() {
int numVar;
float decimalVar;
char charVar;
bool BoolVar;
string stringVar;
double doubleVar;
cout<<"Enter integer:";
cin>>numVar;
cout<<"Size is "<<sizeof(numVar)<<"\n";
cout<<"Enter float:";
cin>>decimalVar;
cout<<"Size is "<<sizeof(decimalVar)<<"\n";
cout<<"Enter char :";
cin>>charVar;
cout<<"Size is "<<sizeof(charVar)<<"\n";
cout<<"Enter string :";
cin>>stringVar;
cout<<"Size is "<<sizeof(stringVar)<<"\n";
cout<<"Enter a double :";
cin>>doubleVar;
cout<<"Size is "<<sizeof(doubleVar)<<"\n";
cout<<"Enter a boolean: ";
cin>>BoolVar;
cout<<"Size is "<<sizeof(BoolVar)<<"\n";
}
/* Output:
Enter integer:12
Size is 4
Enter float:2.6
Size is 4
Enter char :d
Size is 1
Enter string :word
Size is 32
Enter a double :3333333
Size is 8
Enter a boolean: 1
Size is 1
*/