7
This commit is contained in:
		
							parent
							
								
									26330e18e8
								
							
						
					
					
						commit
						538a1d1a4d
					
				| @ -61,7 +61,6 @@ int main() { | ||||
|     char *pend; | ||||
|     stack_top = -1; | ||||
|     bool first_output = true; | ||||
|     bool operation_successful = true; | ||||
| 
 | ||||
|     while (fgets(arr, 50, stdin)) { | ||||
|         if (arr[0] == '\n' || arr[0] == EOF) { | ||||
| @ -76,7 +75,6 @@ int main() { | ||||
|             } | ||||
|             printf("%.2f", number); | ||||
|             first_output = false; | ||||
|             operation_successful = true; | ||||
|         } | ||||
|         else if (is_operation(arr)) { | ||||
|             if (stack_top < 1) { | ||||
| @ -84,7 +82,7 @@ int main() { | ||||
|                     printf("\n"); | ||||
|                 } | ||||
|                 printf("no input\n"); | ||||
|                 return 0;  // Завершение программы при ошибке
 | ||||
|                 return 0; | ||||
|             } | ||||
| 
 | ||||
|             float n2 = pop(); | ||||
| @ -95,22 +93,18 @@ int main() { | ||||
|             if (!first_output) { | ||||
|                 printf(" "); | ||||
|             } | ||||
|             printf("%.2f\n", result); | ||||
|             first_output = true;  // Ожидаем новый ввод на новой строке
 | ||||
|         } | ||||
|         else { | ||||
|             if (!first_output) { | ||||
|                 printf("\n"); | ||||
|             } | ||||
|             printf("no input\n"); | ||||
|             return 0;  // Завершение программы при ошибке
 | ||||
|             printf("%.2f", result); | ||||
|             first_output = false; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if (stack_top == 0) { | ||||
|         printf("%.2f\n", pop()); | ||||
|         if (!first_output) { | ||||
|             printf(" "); | ||||
|         } | ||||
|         printf("\n%.2f\n", pop()); | ||||
|     } else { | ||||
|         printf("no input\n"); | ||||
|         printf("\nno input\n"); | ||||
|     } | ||||
| 
 | ||||
|     return 0; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user