Why can't I get this do while loop to work. It's killin me Sup Forumsros

Why can't I get this do while loop to work. It's killin me Sup Forumsros.

Maybe its the syntax. Try putting the return statement a line down.

really?? me as a slav fuck can solve this
you can be ashamed of yourself

Or maybe dont define the variable in the loop

This. answer isn't in the scope of the while section.

Or you know what, I shouldnt be telling you this shit. Maybe youre just not intelligent enough.

The scope for the variable "answer" is limited to inside the "do" block. Declare the variable before the do statement.

put string answer; outside of the loop dumbass

"Answer" have to create out of the scope. Try to declare the variable before the do.

Then how would I go about coding something like this? Where I want a question to be repeated (after other code of course) until a certain answer is given?

Aren't you supposed to put action of the loop in curly brackets? Dunno, not using C++.

I did this but no matter what I entered for answer on the cin command it would just repeat the code.

Just simply declare "answer" before the loop

You need to set answer = "reply to this post or your whore of a mother will die in her sleep tonight"

Just create the empty string before your do man. If you create it inside the parentheses it only exists within those parentheses, and the while condition is outside.

Read the error the compiler gives you stupid spastic ADD fucktard idiot.

Ah I figured out that you also have to remove the "string answer;" from the while loop. I had left it in there. Thanks dudes.

>spastic

No sense of irony here I see?

It's literally my first day teaching myself to code you baboon.

Theres a special place in hell for people that doesnt post info when asking for help.

Incidentally your return line is too indented, looks to me like it should be level with the do above. Don't suppose it really matters though. Whatcha writing?

The compiler errors are IN the picture.

Did you get it to work? Im unsure if you can do string compare like that in C

Lol. So why are you asking us, it said what was wrong you dumb dumb.

Just kind of a Zork type thing. I figure the best way to learn coding naturally is to give yourself problems to solve. This is my progress. It's sloppy but I'm still learning.
Yes, it is working now, thank you.

>I figured out
I wish you suffering

That first code was a sample code I got from a forum. Compiler just said undefined, nothing about scope. So yknow.

It will never say scope. The compiler doesnt go looking for variables you might have hidden from it.