Change time format
Can guide me how to change the time format if i input 5.45pm and the output will display 17.45 hours. Pls help
This seems like a pretty obvious homework question. Do you have any code so far?
need to read the input on 5.45 or pm and then convert it if pm was encountered. is it like that?
pls help on my code, when i input 6:45p .. the output show only '6 45', the ':' and 'p' are gone. Pls correct me where i go wrong.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <stdafx.h>
#include <stdio.h>
int main(void)
{
int hour = 0;
int min = 0;
char dot = ':' || '.';
char zone = 'a' || 'p';
printf("Enter time (H:Mx): ");
scanf_s("%d%c%d%c", &hour, &dot, &min, &zone);
printf("time is %d%c%d%c",hour,dot,min,zone);
}
| |
Topic archived. No new replies allowed.