September 19th, 2003, 06:15 PM
24-hour time then display time in 12-hour form
can someone help me get through this program
Enter a 24-hour time:21:11
Equivalent 12-hour time:9:11 pm
becareful not to display 12:00 as 0:00
this is how I did it but it did not work
12-hour time,24-hour time;
printf("Enter 24-hour time: ");
please help this is c language program
September 19th, 2003, 08:04 PM
I don't think you're even trying. If you're going to post code at the very least it should be something that might have a chance of compiling. What you've written doesn't even make any sense.
And use code tags!
Just think of what it takes to convert normal time to that 12-hour nonsense. You're going to read in the time, parse out the hours, and then depending on its value you'll figure out whether it is ante meridian or post meridian and create your output accordingly. The only coding structure you should need would be if-then-else. Real simple.