Queue help

Pages: 12345
Apr 18, 2020 at 2:05pm
you rather post a long ass nonsense message rather than actually help me. incredible
Apr 18, 2020 at 2:06pm
I ALREADY HAVE THE STACK PROGRAM DONE ! Reason I need help with a Queue now
Apr 18, 2020 at 4:14pm
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.
Last edited on Apr 18, 2020 at 4:37pm
Apr 18, 2020 at 4:15pm
@dhayden, See what you get?

cblack618 wrote:
you rather post a long ass nonsense message rather than actually help me. incredible

The mentally diseased fatass finds normal actions "incredible" while her own bizarre actions are presumably normal to her. She's literally psychotic.

I despise the mentally diseased (and drug addicts).
"Me me me" is their only thought.
Apr 18, 2020 at 4:48pm
all I know is cin, cout, and how to declare variables. Anything beyond that I need help with. Since u keep asking what I need help with
Apr 18, 2020 at 5:02pm
Start here:
https://www.learncpp.com/

Keep reading and rereading and rereading until what you've read makes sense or your head explodes.

This is YOUR college course, not ours, you need to make an effort to understand the material. We can't do any of that for you.

Don't bother coming back with "I'm just a beginner" because that is just a fucking excuse and a cop-out.

Either DO or DON'T DO. Nothing else is possible.

Did you even look at my not complete list of what is wrong with the code you gave us? How are you going to fix those problems? Yes, YOU. Not us. This is YOUR assignment.
Apr 18, 2020 at 5:07pm
Bye. You’re rude
Apr 18, 2020 at 5:10pm
Damn, dude, I try to help you and all you do is throw insults.

You sure won't get any help from others with such a shitty attitude.

FUCK YOU.
Apr 18, 2020 at 5:13pm
K bye. Don’t come on here bashing me and insulting me when I am purely looking for help.
Apr 18, 2020 at 5:13pm
dutch wrote:
@dhayden, See what you get?
Yeah, that surprised me. :)

Anyway, cblack618, are you required to write your own queue code? C++ has a queue template that would work great.

Either way, the trick is to recognize that to do this problem, you still use the queue like a stack: when you see a closing parenthesis, you remove the most recently inserted item. It's always Last In, First Out (LIFO)
Apr 18, 2020 at 5:17pm
I understand stacks and queues use a LIFO and FIFO method but don’t know how to actually code that
Apr 18, 2020 at 5:21pm
howd you get past csi 101
Apr 18, 2020 at 5:21pm
Apr 18, 2020 at 9:27pm
can someone tell me if this is how to do a queue and how to fix the error at line 57 ?

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <iostream>
#include <string>
#include <stack>
#include <queue>

using namespace std;

bool isBalanced(string s);

int main()
{

    cout << "This program checks a string to see if its parentheses are properly \n";
    cout << "balanced.";


    string str;
    cout << "\nType in a string with some parenthesis:\n";
    getline(cin, str);


    if (isBalanced(str))
        cout << "The string has balanced parentheses.";
    else
        cout << "The string does not have balanced parentheses.";
    return 0;
}

bool isBalanced(string str)
{
    queue<char> charQueue;
    for (unsigned int k = 0; k < str.length(); k++)
    {
        switch (str[k])
        {
        case '(':
            // Put left paren on stack
            charQueue.push(str[k]); break;
        case ')':

            if (charQueue.empty())
                return false;
            else
                charQueue.pop();
            break;
        default:

            ;
        }
    }
    if (charQueue.empty())
        return true;
    else
        return false;
}

    }
};
Apr 18, 2020 at 9:31pm
Seriously, anyone who helps her at this point should have their account cancelled.
Apr 18, 2020 at 9:34pm
dude go away. I am tired of you harassing me. I am just here to get freaking help and all you do is spam and harass.
Apr 18, 2020 at 9:35pm
Thanks for "unblocking" me!

You are the troll.
Nobody is this stupid.
Last edited on Apr 18, 2020 at 9:38pm
Apr 18, 2020 at 9:37pm
get a life snitch
Apr 18, 2020 at 9:40pm
get a brain, black.
Apr 18, 2020 at 9:41pm
k
Pages: 12345