pvjc20/du3/program.c

27 lines
447 B
C

#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
int main()
{
printf("Enter date: ");
char dateStr[11];
struct tm t;
fgets(dateStr, 11, stdin);
strptime(dateStr, "%d.%m.%Y", &t);
t.tm_mday += 7;
strftime(dateStr, sizeof(dateStr), "%d.%m.%Y", &t);
printf("The day of the week is %s", dateStr);
exit(EXIT_SUCCESS);
return 0;
}