Slot Machine help

Im new to C++ and trying to make my own little program for fun. I was at the casino the other day playing quarter slots and I was inspired to make my own little slot program. This is what I have thus far. Any advice or thoughts would be appreciated. Some problems I am having are the user's credits not updating correctly such as adding the winnings to the user's credit and subtracting the bet. I also need a better way to stop the program; when 'q' is entered it just runs an infanate loop...which is a no no.... so any Ideas? Pointers? Thanks in advance.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//Slot Machine Game


#include <iostream>
#include <ctime>
#include <cmath>
#include <string>
#include <iomanip>

using namespace std;

int main()
{
		srand(time(NULL)); 

	unsigned int wheel1;
	unsigned int wheel2;
	unsigned int wheel3;
	unsigned int userBet;

	int userCredit = 1000;

////////////////////////////////// INTRO ////////////////////////////////
	cout << setw(50) << "WELCOME TO C++ SLOTS!" << endl;               //
	cout << setw(50) << "_____________________" << endl;               //  
	cout << endl;                                                      //
	cout << setw(56) << "333 = 1000c, 222 = 500c, 111 = 100c" << endl; //
	cout << setw(56) << "-33 =   50c, -22 =  25c, -11 =  10c" << endl; //
	cout << endl;                                                      //
/////////////////////////////////////////////////////////////////////////

	cout << "Your current credit is " << userCredit << "c\n" << endl;
	cout << "Please bet 25c: ";
	cin >> userBet;
	cout << "\n";

     do
	 {

	 if(userBet != 25)
	 {
		 cout << "Invalid credits, please bet 25 credits: ";
		 cin >> userBet;
		 cout << "\n";
		 userCredit = userCredit - userBet;
		 
	 }
		  
     wheel1 = rand() % 3 + 1;
	 wheel2 = rand() % 3 + 1;
	 wheel3 = rand() % 3 + 1;

	 cout << "----" << "| " << wheel1 << " |--" << "| " << wheel2 << " |--" << "| " << wheel3 << " |" << "----\n" << endl;


	 if(wheel1 == 3 && wheel2 == 3 && wheel3 == 3) // WIN 1000c
	 {
		 userCredit = userCredit - userBet;
		 cout << "You won 1000c! Your current credit now = " << userCredit + 1000 << endl; 
	 }
	 else if(wheel1 == 2 && wheel2 == 2 && wheel3 == 2)  // WIN 500c
	 {
		 userCredit = userCredit - userBet;
		 cout << "You won 500c! Your current credit now = " << userCredit + 500 << endl; 
	 }
	 else if(wheel1 == 1 && wheel2 == 1 && wheel3 == 1) //WIN 100c
	 {
		 userCredit = userCredit - userBet;
		 cout << "You won 100c! Your current credit now = " << userCredit + 100 << endl; 
	 }
	 else if(wheel2 == 3 && wheel3 == 3) // WIN 20c
	 {
		 userCredit = userCredit - userBet;
		 cout << "You won 50c! Your current credit now = " << userCredit + 50 << endl; 
	 }
	 else if(wheel2 == 2 && wheel3 == 2) // WIN 25c
	 {
		 userCredit = userCredit - userBet;
		 cout << "You won 25c! Your current credit now = " << userCredit + 25 << endl; 
	 }
	 else if(wheel2 == 1 && wheel3 == 1) // WIN 10c
	 {
		 userCredit = userCredit - userBet;
		 cout << "You won 10c! Your current credit now = " << userCredit + 10 << endl; 
	 }
	 else 
	 {
		 userCredit = userCredit - userBet;
		 cout << " Current credit = "<< userCredit << "c Please bet again or bet 'q' to quit.\n" << endl;
		 cout << "Bet: ";
		 cin >> userBet;
		 cout << "\n";
	 }

	 }while(userBet != 'q');

	return 0;
}
Im new to C++

Then this is appropriate for the beginner forum.

Just as you decrease userCredit for losing, you need to increase userCredit for winning. cout << userCredit + 1000 just prints 1000 more than userCredit, it doesn't increase it.

Since userBet is an unsigned int, it can't receive a char as input. Read this: http://msdn.microsoft.com/en-us/library/71t65ya2%28v=vs.80%29.aspx
Topic archived. No new replies allowed.