// tikrina ar teisingai kliaustai sudeti #include #include #include "stack.h" using namespace std; int main(int argc, char *argv[]) { stack s; int i=0; char *str; int d=0; int k=0; str = "[{[]}]"; int n=6; while (i < n) { switch(str[i]) { case '{': s.push(1); break; case '[': s.push(2); break; } i++; } i=0; while (i< n) { switch(str[i]) { case '}': {d = s.pop(); if (d != 1) k++;}; break; case ']': {d = s.pop(); if (d != 2) k++;} break; } i++; } d = s.pop(); if (d != -1 || k != 0) cout << "Skliaustuose klaidu yra" << endl; return EXIT_SUCCESS; }