Do-While loop help!

Okay. That seems to be working, but my do-while loop keeps repeating itself when called on. Here's my code... can you see what's wrong?

#include <iostream>;
#include <cstdlib> //drand function
#include <ctime> // time function
#include <Windows.h> //Sleep function
using namespace std;

/* *****************

1/20/13
This program was made
so that people can
understand and
experience how video
games are made using
the language of C++
***************** */

//start( float radius); //Function Prototype
//float volumes( float radius); // Function Prototype

int main()

{

int num;
int menuchoice;
char input;
float bet = 's';


// Suspend program for 2 seconds

Sleep(2000);
//seed random number ganerator using the system clock
srand(static_cast<unsigned int> (time(0)));
//generate a random number between 1 and 13
num = rand() % 13 + 1;




// Welcome user to the introduction screen

cout << " BLACKJACK\n\n\n";
cout << " Thank you for playing this game!\n\n";
cout << " Press 'b' to Start the game\n";
cout << " Press 'i' for intructions on the game\n";
cout << " Press 'c' for credits on the game\n";


// Show the instructions
cin >> input;

if (input == 'i')

{
cout << " The game you will be playing is called 'Blackjack' or 'twenty-one'.\n This is a multiplayer games in which one of the players want to get cards";

}

cin >> input;

if (input == 'c')

{

cout << " The writer, producer, developer, and artist of this game is";

}

cin >> input;

if (input == 'b')
{
do
{

//Tell the user what card they got

cout << " You got" << num;

// Add up all the user"s cards and print

// Ask them if the y want to hit or stay

cout << " Would you like to get hit ('h') or stay ('s')";

//If they want to hit, loop back to generating a random number again otherwise let the computer get a hand

}while (bet == 's');
}
}
The loop condition depends on the value of bet. However, I don't see anywhere within the loop where this value can be changed.

Thus it must repeat forever.
Is there any way to fix this problem ie. take stuff out, rearrange ect.
It looks as though there is a cout which asks the user for some input. But the cin statement to get that input is missing.
and change the type of bet to char -> char bet

You need to input bet as well:
1
2
cout << " Would you like to get hit ('h') or stay ('s')";
cin >> bet;



Please use code tags: [code]Your code[/code]
See: http://www.cplusplus.com/articles/z13hAqkS/
Thanks Guys!!! My problem has been fixed, but now I face the problem of saying what the total amount they have gotten.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
	// Let Player 1 go first

			cout << " Player 1's turn!!!";

			// Tell the player what card they got

			cout << " You got" << num;

			// Add up all the user"s cards and print

			

			// Ask them if the y want to hit or stay

			cout << " Would you like to get hit ('h') or stay ('s')";

			//If they want to hit, loop back to generating a random number again otherwise let the computer get a hand

			cin >> choice;

			}while (choice == 'h');

In the "Add up all the user's cards and print" the total is supposed to be 'num', but num has to be used for several different numbers, so how do I add all those 'nums' to make a 'total' ?
Topic archived. No new replies allowed.