From d0b84e0d936e0da93f42b5859cf9ae798b7a4bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=A9re=C5=A1?= Date: Tue, 29 Oct 2019 13:28:38 +0000 Subject: [PATCH] Aktualizovat "program.c --- program.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/program.c b/program.c index 0edd89c..1443c9a 100644 --- a/program.c +++ b/program.c @@ -6,6 +6,7 @@ int main() { char* prve_cislo = malloc(100* sizeof(char)); char* druhe_cislo = malloc(100* sizeof(char)); fgets(prve_cislo,100,stdin); + strtok(prve_cislo,"\n"); if (isalpha(*prve_cislo)){ printf("%s je neplatny zapis.\n",prve_cislo); free(prve_cislo); @@ -24,7 +25,13 @@ int main() { cislo2 -= cislo1; } } + if (isalpha(*prve_cislo)){ + printf("%s je neplatny zapis.\n",prve_cislo); + free(prve_cislo); + free(druhe_cislo); + return 0; + } printf("%d",cislo1); }