online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <iostream> using namespace std; // variables to store data int option_selected; int time2convert1; int time2convert2; int time2convert3; double converted12; int converted24a, converted24p; //function for option 1 12 hour to 24 hour am int conv12to24a(int time2convert1) { cout << "Enter time AM to convert: " << endl; cin >> time2convert1; converted24a = time2convert1; return converted24a; } //function for option 2 12 hour to 24 hour pm int conv12to24p(int time2convert2) { cout << "Enter time PM to convert: " << endl; cin >> time2convert2; converted24p = time2convert2 + 12; return converted24p; } //function for option 3 24 hour to 12 hour double conv24to12(double time2convert3) { cout << "Enter time to convert: " << endl; cin >> time2convert3; if (time2convert3 > 1200) { converted12 = time2convert3 - 1200; return converted12; } else { converted12 = time2convert3; return converted12; } } int main() { int option_selected = 0; cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " << endl; cout<<"^^Hello there!! Step right up!^^ " << endl; cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " << endl; cout<<"^^^ Let's convert some time ^^^^ " << endl; cout<<"^^^^^^^^^ shall we???^^^^^^^^^^^ " << endl; cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " << endl; cout<<"^^^Select option 1 to convert ^^ " << endl; cout<<"^^^^^^^12 hour AM to 24 hour^^^^^ " << endl; cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " << endl; cout<<"^^^And option 2 to convert ^^^^^ " << endl; cout<<"^^^12 hour PM to 24 hour^^^^^^^^ " << endl; cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " << endl; cout<<"^^^^And option 3 to convert ^^^^^ " << endl; cout<<"^^^^^24 hour to 12 hour^^^^^^^^^^ " << endl; cout<<"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " << endl; cin >> option_selected; if(option_selected == 1) { conv12to24a(time2convert1); cout << "The converted time is " << converted24a << "00 hours."; } else if(option_selected == 2) { conv12to24p(time2convert2); cout << "The converted time is " << converted24p << "00 hours."; } else if (option_selected == 3) { conv24to12(time2convert3); if(converted12 < 12){ cout << "The converted time is " << converted12 << " AM." << endl; } else { cout << "The converted time is " << converted12 << " PM." << endl; } } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue