Okay, so I'm starting out just now making a simple Q & A program for a class right now, but when I type in the correct if value for "question", it skips right to the "else" ---- but only if there's a space contained in the value. How can I fix this?
Here's the coding:
#include <iostream>
#include <string>
using namespace std;
int main()
{
system("color 0a");
string question;
pstart:
system("cls");
cout << "What is your question?";
cout << endl;
cout << endl;
cout << " :";
cin >> question;
if(question == "space space") //doesn't recognize the value when there's a space inbetween the two words
{
cout << endl << endl << " 42." << endl << endl;
system("pause");
goto pstart;
}
else
{
cout << endl << endl << " Your question is invalid." << endl << endl;
system("pause");
goto pstart;
}
}