This commit is contained in:
Matej Hajduk 2025-10-15 17:30:16 +02:00
parent 5e7e41928a
commit 6b136feceb

View File

@ -12,7 +12,7 @@ struct stack{
}; };
void print(struct stack *s) void print(struct stack *s)
{ {
for(int i = 0; i < s ->values[i]; i++){ for(int i = 0; i < s->size; i++){
printf("%.2f ", s->values[i]); printf("%.2f ", s->values[i]);
} }
printf("\n"); printf("\n");
@ -36,7 +36,10 @@ int main(){
while(fgets(x, 100, stdin)){ while(fgets(x, 100, stdin)){
x[strcspn(x, "\n")] = 0; x[strcspn(x, "\n")] = 0;
if (strlen(x) == 0) continue; if (strlen(x) == 0) {
print(&mystack);
continue;
}
char *endptr; char *endptr;
float num = strtof(x, &endptr); float num = strtof(x, &endptr);