Update cv3/program.c
This commit is contained in:
		
							parent
							
								
									204652d772
								
							
						
					
					
						commit
						2a8785df19
					
				| @ -21,6 +21,8 @@ int main() { | ||||
|     memset(&mystack, 0, sizeof(struct stack));  | ||||
| 
 | ||||
|     char input[50]; | ||||
|     int empty_input = 0;   | ||||
|      | ||||
|     while (1) { | ||||
|          | ||||
|         if (!fgets(input, sizeof(input), stdin)) { | ||||
| @ -30,7 +32,7 @@ int main() { | ||||
|         input[strcspn(input, "\n")] = 0;   | ||||
| 
 | ||||
|         if (strlen(input) == 0) { | ||||
|             printf("no input\n");   | ||||
|             empty_input = 1;   | ||||
|             break; | ||||
|         } | ||||
| 
 | ||||
| @ -76,10 +78,16 @@ int main() { | ||||
|         print_stack(&mystack); | ||||
|     } | ||||
| 
 | ||||
|     | ||||
|     if (empty_input) { | ||||
|         printf("no input\n"); | ||||
|     } | ||||
| 
 | ||||
|     return 0; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| void push_stack(struct stack* stack, float value) { | ||||
|     assert(stack->size < STACK_SIZE);  | ||||
|     stack->values[stack->size] = value; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user