Let's recap with the code you threw at us:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
using namespace std;
class isBalanced {
string* arr;
string FrontNode;
isBalanced() {
arr = newString[30];
}
void putInQueue{
rear = (rear + 1);
arr[rear] = item;
count++;
}
void takeOutQueue{
frontNode = arr[front];
count--;
}
void main()
{
string firstparens = "";
string secondparens = "";
for (int i = 0; i < arr.length(); i++) {
if (arr[i] == "("))
firstparens = "("
if ((firstparens == "(") && (secondparens == ")")
cout << "hit";
}
}
};
| |
void main() ? That isn't valid in C++.
Defining your main function within the body of your class? Bloody hell, that is not even remotely correct.
No included headers?
Using variables you haven't defined?
rear screams "what the fuck am I?"
If you are supposed to write code for a custom queue container where is it? Even a simplified class declaration would be a start.
This is not the first time you've dumped code like that on us.
What type of help are you looking for? More than a few people have explained what is wrong more than once, yet you don't make the changes that would FIX things.
If you are expecting us to rewrite the code for you without even an attempt by you, not going to happen.
If you have working custom stack code it should be not that hard to modify it for a queue. Even for a beginner.