
Originally Posted by
theelement12
No problem. Have fun

Hey, I know you're learning just like me but quick question. Instead of using a number guessing thing, in which you would use, like you did int ThisIsANumber; what is the prefer to store characters? Wouldn't it be like string SuperSecretPassword; for example?
OK WELL EDIT! I figured out that string is correct, but now I have this dillema.
Code:
#include <iostream>
using namespace std;
int main()
{
string Answer;
string BluePill;
BluePill = 10;
cout << "Welcome to the matrix, should you choose the BluePill " << endl;
cout << "You will return to what you refer to as normal, and live out " << endl;
cout << "the rest of your meaningless life. OR, you could choose the " << endl;
cout << "Bluepill, in which case your life will change forever. You will " << endl;
cout << "be immersed into a world like nothing you've seen before. " << endl;
cout << "So the choice is your's, the RedPill, or The BluePill? " << endl;
cout << "Please enter your answer, either RedPill, or BluePill :" << endl;
cin.get();
cin.get();
cin >> Answer;
cin.ignore();
if (Answer == BluePill)
{
cout << "Welcome to the Matrix";
}
else
{
cout << "Good luckk with the rest of your pathetic life moron.";
}
return 0;
}
What happens is the window opens, it shows all my writing and such, but regardless of my input answer I receive: Good Luckk with the rest of your pathetic life moron.
Also, regardless of my placement of cin.get(); / cin.ignore(); the window doesn't stay open after my input.
Help?
EDIT AGAIN!
I believe I may have run into an issue when I tried to make BluePill a variable, because I can't just declare it with out defining it, and because I can't really think of a definition of blue pill, I just gave it the value of ten, but since the possible answer isn't ten, then regardless RedPill Or BluePill will draw me the answer "Good luckk with the rest of your Pathetic Life Moron"
So then I believe my bigger question is.....How do I declare a string variable without having to give it an integral definition?
EDIT AGAIN! So many edits!
I had to fix a few things in this also before I compiled, I originally wanted to make it Red Pill or Blue Pill, but my compiler had a problem dealing with the space inbetween so I had to switch to RedPill or BluePill.
So another question would be: is there a way to declare a string variable with a space or do I just have to make it work? Or instead of using a string variable is there a more efficient, be it more advanced, way to do this so that I don't just keep trying to find out there's no possible way.
EDIT YET AGAIN! HAHA!
I figured out my window closing problem, and then I thought about WHEN it was closing. It was closing after the ELSE portion of the IF, Then, Else Loop. So I added cin.get(); after the Else statement, and now my window remains open. I believe my only remaining problem in the code is I'm not properly declaring my string variable. As I even changed the value of BluePill from BluePill == 10 to BluePill = BluePill still to no avail.