Fixing
This commit is contained in:
parent
1ad43d39a8
commit
4571891c89
@ -96,15 +96,11 @@ 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 == line) {
|
if (endptr != '\0') {
|
||||||
printf("bad input\n");
|
printf("bad input\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user