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.

Printable View

- 08-21-2011Kipper DeVera[HELP] Code to Convert Army Time to Normal Time?
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. - 08-21-2011manasij7479
- 08-21-2011Kipper DeVera
Oh okay sorry, sorry. Imma upload my first try.

- 08-21-2011AndrewHunter
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?

- 08-21-2011Kipper DeVera
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;

}

- 08-21-2011AndrewHunter
No, you don't seem to get it. Do you know how to add and subtract?

- 08-21-2011Alexandre
Hint. The answer is 12.

- 08-21-2011Kipper DeVera
Uhh herpderp. Yes, yes I do.

- 08-21-2011Alexandre
Then use that number. And substraction.

- 08-21-2011AndrewHunter