Write a C program to set the time to 91505 PMSolution 2 3 4
Write a C program to set the time to 9:15:05 PM.
Solution
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <time.h>
int main()
{
struct tm strtime;
time_t timeoftheday;
strtime.tm_year = 2016-1900;
strtime.tm_mon = 1;
strtime.tm_mday = 4;
strtime.tm_hour = 09;
strtime.tm_min = 15;
strtime.tm_sec = 05;
strtime.tm_isdst = 0;
timeoftheday = mktime(&strtime);
printf(ctime(&timeoftheday));
return 0;
}
#include <stdio.h>
#include <time.h>
int main()
{
struct tm strtime;
time_t timeoftheday;
strtime.tm_year = 2016-1900;
strtime.tm_mon = 1;
strtime.tm_mday = 4;
strtime.tm_hour = 09;
strtime.tm_min = 15;
strtime.tm_sec = 05;
strtime.tm_isdst = 0;
timeoftheday = mktime(&strtime);
printf(ctime(&timeoftheday));
return 0;
}
| 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <stdio.h> #include <time.h> int main() { struct tm strtime; time_t timeoftheday; strtime.tm_year = 2016-1900; strtime.tm_mon = 1; strtime.tm_mday = 4; strtime.tm_hour = 09; strtime.tm_min = 15; strtime.tm_sec = 05; strtime.tm_isdst = 0; timeoftheday = mktime(&strtime); printf(ctime(&timeoftheday)); return 0; } |

