I want to use the int balance
and cPercent
and so on in both of my functions. How would I do this?
link to pastebin. And the code:
int main()
{
int balance = 100;
int cPercent;
float bet;
float thirty = 1.3;
int outcome;
std::cout << "Welcome!\n";
std::cout << "\nYour balance is currently: " << balance << "$\n";
std::cout << "Would you like to have 50% or 30% or 70% chance percent of winning?\n";
std::cout << "Type 1 for 30%, 2 for 50% and 3 for 70%";
std::cin >> cPercent;
while(1){}
}
void gamble()
{
int gPercent = (rand() % 10);
if (cPercent = 1) {
if (gPercent < 3) {
outcome = floor(bet * thirty);
}
else if (cPercent = 2) {
}
}
}