Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "StackArray.h"
- #include "StackList.h"
- using namespace std;
- bool testBalanceBrackets(const char* text, string gear, int maxDeep = 30);
- int main()
- {
- cout << "Input stack type to work with. Either \"Array\" or \"List\": ";
- string stackType = "";
- cin >> stackType;
- if (stackType != "Array" && stackType != "List")
- {
- cerr << "Error! Stack type is incorrect!";
- return -1;
- }
- const char* test1 = "";
- cout << test1;
- cout << (testBalanceBrackets(test1, stackType) ? " right\n" : " wrong\n") << endl;
- const char* test2 = "( )";
- cout << test2;
- cout << (testBalanceBrackets(test2, stackType) ? " right\n" : " wrong\n") << endl;
- const char* test3 = "( ( [] ) )";
- cout << test3;
- cout << (testBalanceBrackets(test3, stackType) ? " right\n" : " wrong\n") << endl;
- const char* test4 = "( ( [ { } [ ] ( [ ] ) ] ) )";
- cout << test4;
- cout << (testBalanceBrackets(test4, stackType) ? " right\n" : " wrong\n") << endl;
- const char* test5 = "( ( [ { } [ ] ( [ ] ) ] ) ) )";
- cout << test5;
- cout << (testBalanceBrackets(test5, stackType) ? " right\n" : " wrong\n") << endl;
- const char* test6 = "( ( [ { } [ ] ( [ ] ) ] )";
- cout << test6;
- cout << (testBalanceBrackets(test6, stackType) ? " right\n" : " wrong\n") << endl;
- const char* test7 = "( ( [ { ] [ ] ( [ ] ) ] ) )";
- cout << test7;
- cout << (testBalanceBrackets(test7, stackType) ? " right\n" : " wrong\n") << endl;
- const char* test8 = "( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (";
- cout << test8;
- cout << (testBalanceBrackets(test8, stackType) ? " right\n" : " wrong\n") << endl;
- const char* test9 = "( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )";
- cout << test9;
- cout << (testBalanceBrackets(test9, stackType) ? " right\n" : " wrong\n") << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement