cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
C++ if problems
C++ if problems
Jan 27, 2009 at 1:34am UTC
ironhustla
(1)
#include<iostream>
#include<string>
using namespace std;
int main()
{
string input;
int money = 0;
int game = 1;
while(game = 1)
{
cin >> input;
if(input == "help")
{
cout << "Type St00fs f0r St00fs t0 happen\n";
}
if(input == "awsome")
{
cout <<"You Stumble along the dirt road and find a penny\n";
money = money + 1;
}
if(input == "money")
{
cout <<"You has " << money << " mooneys\n";
}
if(input == "gameover")
{
cout <<"You die guiz guiz\n";
game = 0;
}
}
return 0;
}
I cant figure out how to get the program to end i type the gameover command making the game = 0 and when game = 0 its not 1 so why doesnt program end
Jan 27, 2009 at 3:28am UTC
psault
(133)
while(game = 1) should be while(game == 1)
~psault
Topic archived. No new replies allowed.