Okay, I've just started learning C++ and I'm on the third chapter of my book which deals with control statements. Basically, I've learned how to create very basic text based games.
#include <iostream>
#include <string>
int main (void)
{
using std::cout;
using std::cin;
using std::string;
string options = "";
bool light = false;
do
{
cout << "You are trapped inside a room that is nearly bare. Aside from the \n"
<< "tiny candle, there is nothing lighting up the room. You can't see\n"
<< "very far, since the candle only allows to to see the door.\n";
cin >> options;
}
while (!light);
{
if (options == "lightpaper" || options == "burnpaper" || options == "feedflame" )
{
cout << "You light the paper on fire!";
light = true;
}
else
cout << "Everything remains dark";
}
return 0;
}
For some reason, it doesn't loop to "You are trapped inside a room (...)" if the first statement = false. Can anyone tell my why that is?