GUYS IM GOIN MAD
im still a newbie with C++ , just started learning yesturday, and now this thing is goin to make me mad, why the fuck it tells me to break?? where is my mistake??????? it tells me the variable play is being used without being initialized :S
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
srand(time(NULL));
int coins = 10,bet,chance,call;
bool play;
char choise;
while(play == true)
{
cout<<"Coins ="<<coins;
cout<<endl;
cout << "Enter a bet : ";
cout <<endl;
cin>>bet;
cout<<endl;
cout<<"Call heads or tails? h/t "<<endl;
cin>>choise;
cout<<endl;
if(choise == 'h')
{
call=1;
}
else{
if(choise == 't'){
call = 0;
}
else{
cout<<"If you didnt choose, i will choose for you";
cout<<endl;
call = rand()%2;
}
}
chance = rand()%2;
if (chance == call)
{
cout<<"You won ";
cout<<endl;
coins = coins + bet;
cout<<"Coins ="<<coins;
cout<<endl;
}
else{
cout<<"You lost..";
cout<<endl;
coins = coins - bet;
cout<<"Coins ="<<coins;
cout<<endl;
}
cout<<"Do you want to bet again? ";
cout<<endl;
cin>>choise;
cout<<endl;
if(choise == 'y')
{
play = true;
}
}
system("pause");
return 0;
}
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
srand(time(NULL));
int coins = 10,bet,chance,call;
bool play;
char choise;
while(play == true)
{
cout<<"Coins ="<<coins;
cout<<endl;
cout << "Enter a bet : ";
cout <<endl;
cin>>bet;
cout<<endl;
cout<<"Call heads or tails? h/t "<<endl;
cin>>choise;
cout<<endl;
if(choise == 'h')
{
call=1;
}
else{
if(choise == 't'){
call = 0;
}
else{
cout<<"If you didnt choose, i will choose for you";
cout<<endl;
call = rand()%2;
}
}
chance = rand()%2;
if (chance == call)
{
cout<<"You won ";
cout<<endl;
coins = coins + bet;
cout<<"Coins ="<<coins;
cout<<endl;
}
else{
cout<<"You lost..";
cout<<endl;
coins = coins - bet;
cout<<"Coins ="<<coins;
cout<<endl;
}
cout<<"Do you want to bet again? ";
cout<<endl;
cin>>choise;
cout<<endl;
if(choise == 'y')
{
play = true;
}
}
system("pause");
return 0;
}