aaa
This commit is contained in:
parent
21f253bef3
commit
184c427638
44
a1/program.c
44
a1/program.c
@ -6,36 +6,46 @@
|
|||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
char Dnes_Datum[30];
|
char Dnes_Datum[30];
|
||||||
struct tm *D_D;
|
int ch=getchar(),counter=0;
|
||||||
struct tm *NW_D;
|
for(int idx=0;ch!=EOF;idx++){
|
||||||
//fgets(Dnes_Datum,30,stdin);
|
|
||||||
//int Day=0,Mon=0,Year=0;
|
|
||||||
//scanf("%d %d %d",&Day,&Mon,&Year);
|
|
||||||
int ch=getchar();
|
|
||||||
for(int idx=0;ch!='\n';idx++){
|
|
||||||
if(ch=='.'){
|
if(ch=='.'){
|
||||||
ch=' ';
|
ch=' ';
|
||||||
}
|
}
|
||||||
Dnes_Datum[idx]=ch;
|
Dnes_Datum[idx]=ch;
|
||||||
|
if(ch=='\n'){
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
ch=getchar();
|
ch=getchar();
|
||||||
|
if(Dnes_Datum[idx]=='\n'&&ch=='\n'){
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char *start=Dnes_Datum, *end=NULL;
|
char *start=Dnes_Datum, *end=NULL;
|
||||||
time_t t=time(NULL);
|
time_t t=time(NULL);
|
||||||
D_D = localtime(&t);
|
|
||||||
|
|
||||||
D_D->tm_mday=strtol(start,&end,10);
|
for(int idx=0;idx<counter;idx++){
|
||||||
start=end;
|
struct tm *D_D;
|
||||||
D_D->tm_mon=strtol(start,&end,10)-1;
|
struct tm *NW_D;
|
||||||
start=end;
|
|
||||||
D_D->tm_year=strtol(start,&end,10)-1900;
|
|
||||||
|
|
||||||
time_t nex_week=mktime(D_D)+604800;
|
D_D = localtime(&t);
|
||||||
|
|
||||||
NW_D=localtime(&nex_week);
|
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;
|
||||||
|
|
||||||
printf("%d.%d.%d\n\n",NW_D->tm_mday, NW_D->tm_mon+1,NW_D->tm_year+1900);
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user