Fixing
This commit is contained in:
parent
4571891c89
commit
82da52cd1f
@ -96,11 +96,15 @@ void process_operations(struct stack* stack) {
|
|||||||
}
|
}
|
||||||
// endpointer pre nacitanie pomocou strtof;
|
// endpointer pre nacitanie pomocou strtof;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
|
// ked' format nie je spravny, prerusime a vypiseme chybu
|
||||||
|
if (line[0] == '.')
|
||||||
|
{ printf("bad input\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
// skusame nacitat' vstup
|
// skusame nacitat' vstup
|
||||||
float val = strtof(line, &endptr);
|
float val = strtof(line, &endptr);
|
||||||
// v pripade ze nie je cislo prerusime a vypiseme chubu
|
// v pripade ze nie je cislo prerusime a vypiseme chubu
|
||||||
if (endptr != '\0') {
|
if (endptr == line) {
|
||||||
printf("bad input\n");
|
printf("bad input\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user