When I run the program at this point i am getting some issues. If I put in 1 or 2 for color it doesn't skip to the else and do the spin procedure. Also if I input a number outside of 1-3 it puts me in the loop and when it exits it doesn't continue. There must be a better way to do all of this. Any help would be appreciated.
#include <iostream>
usingnamespace std;
int main()
{
cout << "Time to play roulette, You start with $100" << endl;
int color;
int odd;
int number;
int money = 100;
int bet;
cout << "Place your Bet\n";
cin >> bet;
if (bet>money){
while (bet>money){
cout << "You do not have " << bet;
cin >> bet;
if (bet<=money){
continue;
}
}
}
else {
cout << "Pick a Color\n1: Red\n2: Black\n3:Skip\n";
cin >> color;
if (color > 3 or color < 1){
while (color > 3 or color < 1){
cout <<"that is not a valid choice, Choose again\n";
cin >> color;
}
}
else {
if (color = 3){
cout << "1: Odd\n2: Even\n3:Skip\n";
cin >> odd;
if (odd > 3 or odd <1){
while (odd > 3 or odd <1){
cout <<"that is not a valid choice, Choose again\n";
cin >> odd;
if (odd >= 1 and odd <=3){
continue;
}
}
}
else{
if (odd = 3){
cout << "Pick a number 1-36\n";
cin >> number;
if (number >36 or number <1){
while (number >36 or number <1){
cout << "that is not a valid choice, Choose again\n";
cin >> number;
if (number >= 1 and number <= 36){
continue;
}
}
}
else{
//Spin Protocall
}
}
else {
//Spin Protocall
}
}
}
else {
//Spin Protocall
}
}
}
}
if (color > 3 or color < 1)
Remove this 'if' and the accompanying 'else'. The condition in 'while' is sufficient. When this condition is true, the else part will be always skipped, and that is causing the bug.