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