Update a1/program.c
This commit is contained in:
		
							parent
							
								
									a4956f1e6f
								
							
						
					
					
						commit
						04a4286f02
					
				| @ -45,13 +45,15 @@ int main() { | ||||
|         else if (current == '}' || current == ']' || current == ')' || current == '>') { | ||||
|             // Если стек пустой, это ошибка
 | ||||
|             if (top == -1) { | ||||
|                 printf("Read: %s\n", input); | ||||
|                 printf("Neočekávaný znak %c na %d, očakávaná otváracia zátvorka.\n", current, position); | ||||
|                 return 1; | ||||
|             } | ||||
| 
 | ||||
|             // Если скобки не совпадают, это ошибка
 | ||||
|             if (!isMatching(stack[top--], current)) { | ||||
|                 printf("Prekrývajúca sa zátvorka %c na %d, očakávaná %c.\n", current, position,  | ||||
|                 printf("Read: %s\n", input); | ||||
|                 printf("Crossed bracket %c in %d, expected %c.\n", current, position,  | ||||
|                        (current == '}') ? '{' : (current == ']') ? '[' :  | ||||
|                        (current == ')') ? '(' : '<'); | ||||
|                 return 1; | ||||
| @ -61,6 +63,7 @@ int main() { | ||||
| 
 | ||||
|     // Если остались открытые скобки в стеке, это ошибка
 | ||||
|     if (top != -1) { | ||||
|         printf("Read: %s\n", input); | ||||
|         printf("Neočekávaný koniec vstupu, očakávaná zatváracia zátvorka pre %c.\n", stack[top]); | ||||
|         return 1; | ||||
|     } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user