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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include "concor.h"
using namespace std;
int main(int nNumberofArgs,char* pszArgs[])
{
int money = 50;
int additive = 0;
char input,input2;
int number = 0;
int number2 = 0;
int color_number = 1;
int pin = 0;
int rpin = 0;
int choice = 0;
for(;;)
{
additive = 0;
number = 0;
number2 = 0;
setcolor(cyan,black);
cout << "Welcome to the lotto! Entering will deduct $10 from your bank account." << endl;
setcolor(green,black);
cout << "You currently have: $" << money << endl;
setcolor(dark_red,black);
cout << "Would you like to proceed? (Y/N): ";
setcolor(yellow,black);
cin >> input;
setcolor(7,black);
cout << endl;
switch(input)
{
case 'y':
case 'Y':
srand((unsigned)time(0));
color_number = 1 + rand() % (15);
if(money == 0)
{
cout << "Warning, you have 0 dollars left. Quit or get money? (Q/M): ";
setcolor(red,black);
cin >> input2;
setcolor(7,black);
switch(input2)
{
case 'q':
case 'Q':
cout << endl << "Thank you, come again!" << endl;
return 0;
case 'm':
case 'M':
money += 50;
cout << endl << "$50 has been added to your wallet!" << endl;
break;
default:
cout << "Q or M...You have kicked out of the store..." << endl;
system("PAUSE");
return 0;
}
}
if(money - 10 < 0)
{
setcolor(7,black);
cout << "You are almost out of money! Quickly hack the 1 digit pin (1-5) of the ATM!: ";
cin >> pin;
rpin = 1 + rand() % (5);
if(pin < 1 || pin > 5)
{
cout << "You should have entered a number from 1 - 5, you have been arrested." << endl;
system("PAUSE");
return 0;
}
if(pin == rpin)
{
money += 20;
cout << "Success! You quickly get 20 dollars from the ATM." << endl;
}
choice = 1 + rand() % (2);
if(choice == 1)
{
cout << "Wrong number, you run away from prying eyes." << endl;
}
else
{
cout << "Wrong number, you have been arrested." << endl;
system("PAUSE");
return 0;
}
}
money -= 10;
if(money < 0)
{
setcolor(red,black);
cout << "You are now in debt and you have to get more money..." << endl;
setcolor(7,black);
return 0;
}
setcolor(green,black);
cout << "You now have $" << money << " in your account." << endl;
setcolor(white,black);
cout << "The lotto has started, may the odds ever be in your favor!" << endl;
setcolor(7,black);
int lotto_number[6];
lotto_number[0] = 1 + rand() % (20);
lotto_number[1] = 1 + rand() % (20);
lotto_number[2] = 1 + rand() % (20);
lotto_number[3] = 1 + rand() % (20);
lotto_number[4] = 1 + rand() % (20);
lotto_number[5] = 1 + rand() % (10);
int choice[6];
cout << "????? *" << endl;
cout << "Enter your (?) choices 1 - 20." << endl;
for(int choices = 0;choices < 5;choices++)
{
setcolor(color_number,black);
cout << "Next: ";
setcolor(color_number + 4,black);
cin >> choice[choices];
setcolor(7,black);
color_number++;
if(choice[choices] < 1 || choice[choices] > 20)
{
cout << "Please enter a number from 1 - 20!" << endl;
choices--;
}
}
for(;;)
{
setcolor(white,black);
cout << "Now enter your powerball number." << endl;
cout << "Please enter 1 - 10" << endl;
setcolor(purple,black);
cin >> choice[5];
if(choice[5] < 1 || choice[5] > 10)
{
cout << "Enter a number from 1 - 10!" << endl;
}
else
{
break;
}
}
color_number = 1 + rand() % (15);
setcolor(white,black);
cout << "The results are coming in..." << endl << "Here are the results!(Choice:Lotto Number) " << endl;
setcolor(yellow,black);
for(int relay = 0;relay < 5;relay++)
{
color_number = 1 + rand() % (15);
cout << "Choice " << relay + 1 << ":\t";
setcolor(color_number,black);
color_number = 1 + rand() % (15);
cout << choice[relay] << "\t:\t";
setcolor(color_number,black);
cout << lotto_number[relay];
setcolor(yellow,black);
cout << "\t Lotto number " << relay + 1 << endl;
}
for(int relay2 = 0;relay2 < 5;relay2++)
{
for(int relay3 = 0;relay3 < 5;relay3++)
{
if(choice[relay2] == lotto_number[relay3])
{
setcolor(green,black);
cout << "You have gotten choice " << relay2 + 1 << " correct!" << endl;
number++;
lotto_number[relay3] = 0;
break;
}
}
}
setcolor(white,black);
cout << endl;
setcolor(cyan,dark_magenta);
cout << "Now for the powerball!" << endl;
cout << "Your powerball is: " << choice[5] << endl;
cout << "The powerball is: " << lotto_number[5] << endl;
if(choice[5] == lotto_number[5])
{
setcolor(green,black);
cout << "You have gotten the powerball right!" << endl;
number2++;
}
setcolor(white,black);
cout << endl << "Thanks you for playing the lotto, play again!" << endl;
break;
case 'n':
case 'N':
cout << "Bye bye!" << endl;
system("PAUSE");
return 0;
}
additive = number * number * number * 5;
additive = additive + number2 * 1000;
cout << "You have won: $";
setcolor(green,dark_green);
cout << additive;
setcolor(white,black);
cout << "!" << endl;
money += additive;
}
}
|