Обновить cv3/program.c
This commit is contained in:
		
							parent
							
								
									80f7810cf7
								
							
						
					
					
						commit
						3acee80c88
					
				| @ -26,7 +26,7 @@ int isFull(StEk* stek) { | ||||
| void push(StEk* stek, double chislo) { | ||||
|     if (isFull(stek)) { | ||||
|         printf("full stack\n"); | ||||
|         exit(1); | ||||
|         return; | ||||
|     } | ||||
|     stek->chisla[stek->vershina] = chislo; | ||||
|     stek->vershina++; | ||||
| @ -35,7 +35,7 @@ void push(StEk* stek, double chislo) { | ||||
| double pop(StEk* stek) { | ||||
|     if (isEmpty(stek)) { | ||||
|         printf("not enough operands\n"); | ||||
|         exit(1); | ||||
|         return 0; | ||||
|     } | ||||
|     return stek->chisla[--stek->vershina]; | ||||
| } | ||||
| @ -61,6 +61,7 @@ int main() { | ||||
| 
 | ||||
|         if (c == '\n' && *bufer != '\n' && *bufer != ' ') { | ||||
|             push(&stek, chislo); | ||||
| 
 | ||||
|         } else if (c == '+' || c == '-' || c == '*' || c == '/') { | ||||
|             if (isEmpty(&stek)) { | ||||
|                 printf("not enough operands\n"); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user