69 lines
1.3 KiB
C
69 lines
1.3 KiB
C
#include<stdio.h>
|
|
#include<string.h>
|
|
#include<time.h>
|
|
#include<stdlib.h>
|
|
|
|
|
|
int main(){
|
|
char Dnes_Datum[300];
|
|
int ch=getchar(),counter=0;
|
|
int id=0;
|
|
for(id=0;ch!=EOF;id++){
|
|
if(ch=='.'){
|
|
ch=' ';
|
|
}
|
|
Dnes_Datum[id]=ch;
|
|
if(ch=='\n'){
|
|
counter++;
|
|
}
|
|
ch=getchar();
|
|
if(Dnes_Datum[id]=='\n'&&ch=='\n'){
|
|
break;
|
|
}
|
|
}
|
|
Dnes_Datum[id]='\0';
|
|
|
|
char *start=Dnes_Datum, *end=NULL;
|
|
time_t t=time(NULL);
|
|
|
|
for(int i=0;i<strlen(Dnes_Datum);i++){
|
|
if((Dnes_Datum[i]>='0'&&Dnes_Datum[i]<='9')||Dnes_Datum[i]==' '||Dnes_Datum[i]=='\n');
|
|
else {
|
|
printf("Neplatny datum.\n");
|
|
while(Dnes_Datum[i]!='\n'){
|
|
i++;
|
|
}
|
|
i++;
|
|
counter--;
|
|
start+=i;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
for(int idx=0;idx<counter;idx++){
|
|
struct tm *D_D;
|
|
struct tm *NW_D;
|
|
|
|
D_D = localtime(&t);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|