From 2d57a9050bd47adf5338475289060a1971df803a Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Sun, 27 Mar 2022 19:35:59 +0200 Subject: [PATCH] aaa --- a1/program.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/a1/program.c b/a1/program.c index f409b52..55857d6 100644 --- a/a1/program.c +++ b/a1/program.c @@ -7,19 +7,29 @@ int main(){ char Dnes_Datum[300]; int ch=getchar(),counter=0; - for(int idx=0;ch!=EOF;idx++){ + for(id=0;ch!=EOF;id++){ if(ch=='.'){ ch=' '; } - Dnes_Datum[idx]=ch; + Dnes_Datum[id]=ch; if(ch=='\n'){ counter++; } ch=getchar(); - if(Dnes_Datum[idx]=='\n'&&ch=='\n'){ + if(Dnes_Datum[id]=='\n'&&ch=='\n'){ break; } } + Dnes_datum[id]='\0'; + + for(int i=0;i='0'&&Dnes_Datum[i]<='9')||Dnes_Datum[i]==' '); + else { + printf("Neplatny datum.\n"); + return EXIT_SUCCESS; + } + } + char *start=Dnes_Datum, *end=NULL; time_t t=time(NULL);