From 912b504b8bf91f9b314892c75f0990104ed70063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=A9re=C5=A1?= Date: Tue, 29 Oct 2019 13:20:21 +0000 Subject: [PATCH] Aktualizovat "program.c --- program.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/program.c b/program.c index e1347fc..de0abc5 100644 --- a/program.c +++ b/program.c @@ -1,9 +1,18 @@ #include -#include "stdlib.h" +#include +#include + int main() { char* prve_cislo = malloc(100* sizeof(char)); char* druhe_cislo = malloc(100* sizeof(char)); fgets(prve_cislo,100,stdin); + if (isalpha(*prve_cislo)){ + printf("%s je neplatny zapis.\n",prve_cislo); + free(prve_cislo); + free(druhe_cislo); + return 0; + + } int cislo1 = strtof(prve_cislo,NULL); int cislo2; while((fgets(druhe_cislo,100,stdin))){ @@ -20,4 +29,5 @@ int main() { } free(prve_cislo); + free(druhe_cislo); } \ No newline at end of file