-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoHexa.cpp
39 lines (35 loc) · 825 Bytes
/
toHexa.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
#include <iostream>
using namespace std;
int main() {
char str;
int counter = 0;
cout << "Enter string: ";
cin >> str;
if (str >= '0' && str <= '9')
cout << str;
else
switch(str) {
case 'A':
cout << 10;
break;
case 'B':
cout << 11;
break;
case 'C':
cout << 12;
break;
case 'D':
cout << 13;
break;
case 'E':
cout << 14;
break;
case 'F':
cout << 15;
break;
default:
cout << "cannot exist";
break;
}
return 0;
}