2022-03-27 14:45:37 +00:00
|
|
|
#include<stdio.h>
|
2022-03-27 16:57:22 +00:00
|
|
|
#include<string.h>
|
|
|
|
#include<time.h>
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
2022-03-27 14:45:37 +00:00
|
|
|
|
|
|
|
int main(){
|
2022-03-27 17:29:12 +00:00
|
|
|
char Dnes_Datum[300];
|
2022-03-27 17:18:45 +00:00
|
|
|
int ch=getchar(),counter=0;
|
2022-03-27 17:37:26 +00:00
|
|
|
int id=0;
|
2022-03-27 17:35:59 +00:00
|
|
|
for(id=0;ch!=EOF;id++){
|
2022-03-27 16:57:22 +00:00
|
|
|
if(ch=='.'){
|
|
|
|
ch=' ';
|
|
|
|
}
|
2022-03-27 17:35:59 +00:00
|
|
|
Dnes_Datum[id]=ch;
|
2022-03-27 17:18:45 +00:00
|
|
|
if(ch=='\n'){
|
|
|
|
counter++;
|
|
|
|
}
|
2022-03-27 16:57:22 +00:00
|
|
|
ch=getchar();
|
2022-03-27 17:35:59 +00:00
|
|
|
if(Dnes_Datum[id]=='\n'&&ch=='\n'){
|
2022-03-27 17:18:45 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-03-27 16:57:22 +00:00
|
|
|
}
|
2022-03-27 17:38:10 +00:00
|
|
|
Dnes_Datum[id]='\0';
|
2022-03-27 17:35:59 +00:00
|
|
|
|
|
|
|
for(int i=0;i<strlen(Dnes_datum);i++){
|
|
|
|
if((Dnes_Datum[i]>='0'&&Dnes_Datum[i]<='9')||Dnes_Datum[i]==' ');
|
|
|
|
else {
|
|
|
|
printf("Neplatny datum.\n");
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-27 16:57:22 +00:00
|
|
|
|
|
|
|
char *start=Dnes_Datum, *end=NULL;
|
|
|
|
time_t t=time(NULL);
|
|
|
|
|
2022-03-27 17:18:45 +00:00
|
|
|
for(int idx=0;idx<counter;idx++){
|
|
|
|
struct tm *D_D;
|
|
|
|
struct tm *NW_D;
|
2022-03-27 16:57:22 +00:00
|
|
|
|
2022-03-27 17:18:45 +00:00
|
|
|
D_D = localtime(&t);
|
2022-03-27 14:45:37 +00:00
|
|
|
|
2022-03-27 17:18:45 +00:00
|
|
|
D_D->tm_mday=strtol(start,&end,10);
|
|
|
|
start=end;
|
|
|
|
D_D->tm_mon=strtol(start,&end,10)-1;
|
|
|
|
start=end;
|
|
|
|
D_D->tm_year=strtol(start,&end,10)-1900;
|
|
|
|
start=end+1;
|
|
|
|
time_t nex_week=mktime(D_D)+604800;
|
|
|
|
|
|
|
|
NW_D=localtime(&nex_week);
|
|
|
|
|
|
|
|
printf("%d.%d.%d\n\n",NW_D->tm_mday, NW_D->tm_mon+1,NW_D->tm_year+1900);
|
|
|
|
}
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
2022-03-27 16:57:22 +00:00
|
|
|
|
2022-03-27 14:45:37 +00:00
|
|
|
}
|
2022-03-27 16:57:22 +00:00
|
|
|
|
|
|
|
|
2022-03-27 17:18:45 +00:00
|
|
|
|