-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathData Type.cpp
61 lines (55 loc) · 1013 Bytes
/
Data Type.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
//{ Driver Code Starts
// Initial Template for C++
// {Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// } Driver Code Ends
// User function Template for C++
class Solution
{
public:
int dataTypeSize(string str)
{
if (str == "Character")
{
return sizeof(char);
}
else if (str == "Integer")
{
return sizeof(int);
}
else if (str == "Long")
{
return sizeof(long);
}
else if (str == "Float")
{
return sizeof(float);
}
else if (str == "Double")
{
return sizeof(double);
}
else
{
return 0;
}
}
};
//{ Driver Code Starts.
int main()
{
int t;
cin >> t;
while (t--)
{
string str;
cin >> str;
Solution ob;
cout << ob.dataTypeSize(str);
cout << "\n";
}
return 0;
}
// } Driver Code Ends