12345678910111213141516171819202122232425262728293031323334
#include <iostream> #include <string> using namespace std; int main() { } int printMenu() { while (true) { cout << "---------------------------------------------" << endl; cout << "Please choose a command" << endl; cout << "---------------------------------------------" << endl; cout << "0) Exit " << endl; cout << "1) Convert bin to decimal" << endl; cout << "2) Convert hex to decimal" << endl; cout << endl; char str; cin >> str; if (str == '1') { return 1; } if (str == '2') { return 2; } else { return 0; } }
1234
if (strcmp(str, "1") == 0) { return 1; }