# Help me for the insertion of binary function in my add function

 Ed Gon · December 3, 2014 Here is my code, I need the to insert the process where the inputed number converts to binary digit and those numbers will be add in binary form then converts back to decimal as a result. PLEASE HELP~=======#include #include #include using namespace std;int main(){ string cmd; long long ax = 0; bool error = false; cout << "Type in command (type \"HELP\" to see all commands): " <"; getline(cin, cmd);//catches the data if (cmd.find("ADD") == 0){ if (cmd.find(" ") == strlen("ADD")){ string x = cmd.substr(strlen("ADD "), cmd.length()-(cmd.length() - cmd.find(",") + strlen("ADD ")));//store the value of x string y = cmd.substr(cmd.find(",") + 1);//store the value of y ax = atoi(x.c_str()) + atoi(y.c_str()); //calculates the result } else{ error = true; } } else if (cmd.find("PRT AX") == 0 && cmd.length() == strlen("PRT AX")){//Triggers the PRT AX cout << ">AX = " << ax << endl;//Prints the result } else if (cmd.find("HELP") == 0 && cmd.length() == strlen("HELP")){//Triggers the HELP cout << ">" << endl; cout << ">ADD x,y add x and y and save the result in AX" << endl; cout << ">PRT AX display the value of AX" << endl; cout << ">EXIT exit the application" << endl; cout << ">" << endl; } else if (cmd.find("EXIT") == 0 && cmd.length() == strlen("EXIT")){//Triggers the EXIT break; } else{ error = true; } if (error){ cout << ">Error: Unknown command!" << endl; } }}

- page 1