#include<iostream>
#include<string>
usingnamespace std;
int main()
{
string stateOne, stateTwo, stateThree, stateFour, stateFive;
cout << "What is the capital of Arkansas?" << endl;
cin >> stateOne;
if(stateOne == "Little Rock")
{
cout << "That is correct!" << endl;
}
else
{
cout << "That's wrong... The capital of Arkansas is Little Rock" << endl;
}
cout << "What is the capital of Illinois?" << endl;
cin >> stateTwo;
if(stateTwo == "Springfield")
{
cout << "That is correct!" << endl;
}
else
{
cout << "That's wrong... The capital of Illinois is Springfield" << endl;
}
cout << "What is the capital of Michigan?" << endl;
cin >> stateThree;
if(stateThree == "Lansing")
{
cout << "That is correct!" << endl;
}
else
{
cout << "That's wrong... The capital of Michigan is Lansing" << endl;
}
cout << "What is the capital of Oregon?" << endl;
cin >> stateFour;
if(stateFour == "Salem")
{
cout << "That is correct!" << endl;
}
else
{
cout << "That's wrong... the capital of Oregon is Salem" << endl;
}
cout << "What is the capital of California?" << endl;
cin >> stateFive;
if(stateFive == "Sacramento")
{
cout << "That is correct!" << endl;
}
else
{
cout << "That's wrong... The capital of California is Sacramento" << endl;
}
}
The >> operator stops reading as soon as it sees a whitespace character (e.g. space, tab, newline).
If you want to read the whole line you can use std::getline. I recommend using it in conjunction with std::ws because it avoids many problems that you can get when using both >> and std::getline in the same program.