This commit is contained in:
mr314ot 2025-10-16 12:54:37 +02:00
parent bbc798be03
commit 15e6ed87dc

View File

@ -35,7 +35,7 @@ float pop_stack(struct stack *s) {
void print_stack(struct stack *s) {
for (int i = 0; i < s->size; i++) {
if (i > 0) printf(" ");
printf("%g", s->values[i]);
printf("%.2f ", s->values[i]);
}
printf("\n");
}
@ -56,8 +56,11 @@ int main(void) {
memset(&s, 0, sizeof(struct stack));
char line[LINESIZE];
int had_input = 0;
while (fgets(line, sizeof(line), stdin)) {
had_input = 1;
line[strcspn(line, "\n")] = '\0';
//preskocit prazdny riadok
@ -100,5 +103,9 @@ int main(void) {
print_stack(&s);
}
if (had_input) {
printf("no input\n");
}
return 0;
}