diff --git a/cv3/program.c b/cv3/program.c index 7b78371..8d6da9c 100644 --- a/cv3/program.c +++ b/cv3/program.c @@ -81,12 +81,10 @@ int main() { else if (is_operation(arr)) { if (stack_top < 1) { if (!first_output) { - printf(" "); + printf("\n"); } - printf("no input"); - first_output = false; - operation_successful = false; - continue; + printf("no input\n"); + return 0; // Завершение программы при ошибке } float n2 = pop(); @@ -97,34 +95,24 @@ int main() { if (!first_output) { printf(" "); } - printf("%.2f", result); - first_output = false; - operation_successful = true; + printf("%.2f\n", result); + first_output = true; // Ожидаем новый ввод на новой строке } else { if (!first_output) { - printf(" "); + printf("\n"); } - printf("no input"); - first_output = false; - operation_successful = false; - continue; + printf("no input\n"); + return 0; // Завершение программы при ошибке } } - if (operation_successful && stack_top == 0) { - if (!first_output) { - printf(" "); - } - printf("%.2f", pop()); - } else if (!operation_successful) { - if (!first_output) { - printf(" "); - } - printf("no input"); + if (stack_top == 0) { + printf("%.2f\n", pop()); + } else { + printf("no input\n"); } - printf("\n"); return 0; }