Like the program asks for the number of minutes and hours and it converts that to normal time.
For example, if you put 23 hours then 14 minutes it then converts the time to 11:14.
This is a discussion on [HELP] Code to Convert Army Time to Normal Time? within the C++ Programming forums, part of the General Programming Boards category; Like the program asks for the number of minutes and hours and it converts that to normal time. For example, ...
Like the program asks for the number of minutes and hours and it converts that to normal time.
For example, if you put 23 hours then 14 minutes it then converts the time to 11:14.
Oh okay sorry, sorry. Imma upload my first try.
Well, step 1 is to understand the problem. For instance, you do not. 11:14 is only part of the time denoted by 23:14. Are we in the am or pm? Honestly, is this even a real question, how hard is it? Did you notice any correlation betweem 23 and 11? How about 22 and 10?
Yep I do. But first I hafta figure out how to convert that to normal time, Dear god, I get it okay? I suck at programming. Okay now?
Code:#include <iostream> using namespace std; int main (){ int hour, minutes; cout << "Please enter the number of hours: "; cin >> hour; cout << "Please enter the number of minutes: "; cin >> minutes; if (hour == 13) cout << "1" << endl; if (hour == 14) cout << "2" << endl; if (hour == 15) cout << "3" << endl; if (hour == 16) cout << "4" << endl; if (hour == 17) cout << "5" << endl; if (hour == 18) cout << "6" << endl; if (hour == 19) cout << "7" << endl; if (hour == 20) cout << "8" << endl; if (hour == 21) cout << "9" << endl; if (hour == 22) cout << "10" << endl; if (hour == 23) cout << "11" << endl; if (hour == 24) cout << "12" << endl; cout << "The time is " << hour << " : " << minutes << endl; return 0; }
Hint. The answer is 12.
Uhh herpderp. Yes, yes I do.
Then use that number. And substraction.