From 588e2cf43082ddea463f61d286e3c7c61009bcab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=A9re=C5=A1?= Date: Sun, 10 Nov 2019 15:26:13 +0000 Subject: [PATCH] Aktualizovat "program.c --- program.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/program.c b/program.c index 958ad63..978fbb0 100644 --- a/program.c +++ b/program.c @@ -19,19 +19,20 @@ long long int nsd(long long int cislo1,long long int cislo2){ return nsd(cislo2 % cislo1, cislo1); } int main() { - //freopen("vstup.txt","r",stdin); + freopen("vstup.txt","r",stdin); char* prvy_vstup = malloc(100* sizeof(char)); char* druhy_vstup = malloc(100* sizeof(char)); long long int prve_cislo; long long int druhe_cislo; - fgets(prvy_vstup,100,stdin); - strtok(prvy_vstup,"\n"); - if (!isdigit(*prvy_vstup)){ - printf("%s je neplatny zapis.\n",prvy_vstup); - goto koniec; - } else{ - printf("Nacitane %llu\n",prve_cislo = strtoll(prvy_vstup,NULL,0)); + if (fgets(prvy_vstup,100,stdin)){ + strtok(prvy_vstup,"\n"); + if (!isdigit(*prvy_vstup)){ + printf("%s je neplatny zapis.\n",prvy_vstup); + goto koniec; + } else{ + printf("Nacitane %llu\n",prve_cislo = strtoll(prvy_vstup,NULL,0)); + } } while((fgets(druhy_vstup,100,stdin))){