This commit is contained in:
Bohdan Kapliuk 2024-10-12 16:02:36 +03:00
parent 6e146d2094
commit 2852e6831b

View File

@ -59,10 +59,14 @@ int main(){
} }
} }
else{ else{
float cislo = strtof(vstup, NULL); char *endptr;
float cislo = strtof(vstup, &endptr);
if (endptr == vstup || *endptr != '\n') {
printf("bad input\n");
return 0;
}
mystack.values[counter] = cislo; mystack.values[counter] = cislo;
counter++; counter++;
} }
mystack.size = counter; mystack.size = counter;
for(int i =0; i < counter;i++){ for(int i =0; i < counter;i++){