cosdf
This commit is contained in:
parent
b65645ed8a
commit
5681a7d1cc
19
program.c
19
program.c
@ -1,13 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int main(){
|
||||
//int day = 0;
|
||||
//int mounth = 0;
|
||||
//int year = 0;
|
||||
//scanf("%d.%d.%d", &day, &mounth, &year);
|
||||
time_t time;
|
||||
scanf("%e.%m.%Y", &time);
|
||||
printf("%e.%m.%Y", time);
|
||||
int main()
|
||||
{
|
||||
/* initialize */
|
||||
int y=0, m=0, d=0;
|
||||
fgets("%d.%d.%d", &d, &m, &y);
|
||||
struct tm t = { .tm_year=y-1900, .tm_mon=m-1, .tm_mday=d };
|
||||
/* modify */
|
||||
t.tm_mday += 40;
|
||||
mktime(&t);
|
||||
/* show result */
|
||||
printf("%s", asctime(&t)); /* prints: Sun Mar 16 00:00:00 1980 */
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user