This commit is contained in:
Deinerovych 2024-10-16 10:28:05 +02:00
parent 18ecde9c5b
commit 016c07efb5

View File

@ -11,7 +11,7 @@ int stack_top = -1;
bool is_number(char *string) { bool is_number(char *string) {
char *end; char *end;
strtof(string, &end); strtof(string, &end);
return end != string && *end == '\n'; return end != string && (*end == '\n' || *end == '\0');
} }
bool is_operation(char *string) { bool is_operation(char *string) {
@ -99,6 +99,9 @@ int main() {
} }
if (stack_top == 0) { if (stack_top == 0) {
if (!first_output) {
printf(" ");
}
printf("\n%.2f\n", pop()); printf("\n%.2f\n", pop());
} else { } else {
printf("\nno input\n"); printf("\nno input\n");