-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain Function
More file actions
39 lines (37 loc) · 849 Bytes
/
Copy pathMain Function
File metadata and controls
39 lines (37 loc) · 849 Bytes
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
// Main Function
int main()
{
int choice;
int user_num;
string cont;
do {
int final_answer = 0;
ConversionList();
std::cin >> choice;
std::cout << "Enter your number to be converted here: ";
std::cin >> user_num;
switch (choice) {
case 1:
final_answer = BinaryToDecimal(user_num);
cout << " " << final_answer;
break;
case 2:
final_answer = OctalToDecimal(user_num);
cout << " " << final_answer;
break;
case 3:
final_answer = BinaryToOctal(user_num);
cout << " " << final_answer;
break;
case 4:
DecimalToBinary(user_num);
break;
default:
cout << "The choice entered was not valid. Enter a choice properly: ";
continue;
}
cout << "\nDo you wish to continue? yes or no?" << endl;
cin >> cont;
} while (cont == "yes");
return 0;
}