I have this code that works fairly well, but depending if I put an extra while loop or not I get errors:
hw7.cpp:34: error: ‘selected’ was not declared in this scope
hw7.cpp:36: error: ‘first’ was not declared in this scope
hw7.cpp:37: error: ‘second’ was not declared in this scope
hw7.cpp:43: error: ‘second’ was not declared in this scope
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
while(joe.get_money() > 0 && joe.get_money() < 1000)
while(bet >= 0) //THIS LOOP here
cout << "You have " << joe.get_money() << endl;
srand ( (int) time(0) );
cout << "You got a " << first.get_rank() << " of " << first.get_suit()
<< " and a " << second.get_rank() << " of " << second.get_suit() <<".\n";
cout << "How much do you want to bet the next card is in between? ";
cin >> bet;
Why am I getting the error? Is it because the compiler thinks that it might never get to that part of the code?
Not sure but maybe the class isn't set up properly?
Also don't put the srand(int)time(0)); inside the while loop. Put it once at the start of the code or else if you seed it every time it goes through a while loop you will get unwanted results.