Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <string>
- #include <iomanip>
- using namespace std;
- //betting & credits
- int bet;
- int choice;
- int avaCredits = 1000000;
- int amountm;
- string stringbet;
- string stringamount;
- //display
- float displayBet;
- float displayCred;
- string str1("k");
- string str2("m");
- string str3("b");
- // wins & lose for dicing
- float d_wins;
- float d_loss;
- float d_winsPerc;
- float d_lossPerc;
- int winstreak;
- int losestreak;
- //Staking
- int p1_HP = 99;
- int p2_HP = 99;
- int p1_Hit[30];
- int p2_Hit[30];
- int p1_Str[30];
- string player;
- string winner;
- // wins & lose for dice duel
- float d2_wins;
- float d2_loss;
- float d2_winsPerc;
- float d2_lossPerc;
- // wins & lose for staking
- float s_wins;
- float s_loss;
- float s_winsPerc;
- float s_lossPerc;
- //cheats switch
- bool strcheat = true;
- bool hpcheat = false;
- //prototypes
- void PrintMenu();
- void myPause();
- void Deposit() {
- if (stringbet.find(str1)!= std::string::npos) {
- stringbet.replace(stringbet.find(str1),str1.length(),"000"); }
- if (stringbet.find(str2)!= std::string::npos) {
- stringbet.replace(stringbet.find(str2),str2.length(),"000000"); }
- if (stringbet.find(str3)!= std::string::npos) {
- stringbet.replace(stringbet.find(str3),str3.length(),"000000000"); }
- }
- void amountDisplay() {
- if (avaCredits >= 10000 && avaCredits <= 999999){
- displayCred = avaCredits / 1000;
- cout <<" (" << displayCred << "k)" << endl; }
- else if (avaCredits >= 1000000 && avaCredits <= 999999999){
- displayCred = avaCredits / 1000000;
- cout <<" (" << displayCred << "M)" << endl; }
- else if (avaCredits >= 1000000000) {
- displayCred = avaCredits / 1000000000;
- cout <<" (" << displayCred << "B)" << endl;
- }
- }
- //credit system
- void credits() {
- cout << "Enter betting amount: ";
- cin >> stringbet;
- Deposit();
- bet = atoi(stringbet.c_str());
- if (avaCredits == 0) {
- cout << "You don't have enough coins to continue. # cleaned.";
- cout << " " << endl;
- PrintMenu();
- }
- while (bet > avaCredits) {
- cout << "You don't have enough coins. \nEnter again: ";
- cin >> stringbet;
- Deposit();
- bet = atoi(stringbet.c_str());
- }
- }
- //Dicing System
- void Play_Dicing() {
- char again;
- do{
- int diceRoll = (rand() % 100);
- string plusminus;
- cout << " __________________________________________ " << endl;
- cout << "<| ====== DUEL ARENA - Dicing ====== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "Roll a 50 or higher to win your bet. " << endl;
- if (d_wins > 0 || d_loss > 0) {
- d_winsPerc = (d_wins / (d_wins + d_loss)) * 100;
- d_lossPerc = (d_loss / (d_wins + d_loss)) * 100;
- }
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << "Wins: " << d_wins << " || %" << d_winsPerc << endl;
- cout << "Loss: " << d_loss << " || %" << d_lossPerc << endl;
- cout << "Streak: ";
- if (winstreak >= 1) {
- cout << "Win " << winstreak << endl; }
- else if (losestreak >= 1) {
- cout << "Lose " << losestreak << endl;
- }
- cout << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- cout << "Coins: $" << avaCredits;
- amountDisplay();
- cout << endl;
- cout << "" << endl;
- credits();
- cout << " ____ " << endl;
- cout << " /\\' .\\ _____ " << endl;
- cout << " /: \\___\\ / . /\\ " << endl;
- cout << " \\' / . / /____/..\\ " << endl;
- cout << " \\/___/ \\' '\\ / " << endl;
- cout << " \\'__'\\/ " << endl;
- cout << " " << endl;
- cout << "[Rolling dice: " << diceRoll << "]" << endl;
- cout << " " << endl;
- if (diceRoll > 50) {
- losestreak = 0;
- cout << "Congratulations, you won the bet!" << endl;
- avaCredits = avaCredits - bet;
- avaCredits = avaCredits + (bet * 2);
- plusminus = "+";
- ++d_wins;
- ++winstreak;
- }
- else {
- winstreak = 0;
- cout << "Sorry, you loss the bet!" << endl;
- avaCredits = avaCredits - bet;
- plusminus = "-";
- ++d_loss;
- ++losestreak;
- }
- cout << " " << endl;
- cout << "Spoils = " << plusminus << " " << bet;
- if (bet >= 10000 && bet <= 999999){
- displayBet = bet / 1000;
- cout <<" (" << displayBet << "K)" << endl; }
- else if (bet>= 1000000 && bet <= 999999999){
- displayCred = bet / 1000000;
- cout <<" (" << displayBet << "M)" << endl; }
- else if (bet >= 1000000000) {
- displayCred = bet / 1000000000;
- cout <<" (" << displayBet << "B)" << endl;
- }
- cout << endl;
- cout << " " << endl;
- cout << "=============================================" << endl;
- cout << "Coins: " << "$" << avaCredits;
- amountDisplay();
- cout << endl;
- cout << "=============================================" << endl;
- cout << "Play Again? (y/n): ";
- cin >> again;
- } while (again == 'y');
- if (again == 'n') {
- PrintMenu();
- }
- }
- //Dicing System
- void Play_DiceDuel() {
- char again;
- do{
- int p1_diceRoll = (rand() % 100);
- int p2_diceRoll = (rand() % 100);
- string plusminus;
- cout << " __________________________________________ " << endl;
- cout << "<| ====== DUEL ARENA - Dice Duel ====== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "Roll higher than Player 2 to win your bet. " << endl;
- if (d2_wins > 0 || d2_loss > 0) {
- d2_winsPerc = (d2_wins / (d2_wins + d2_loss)) * 100;
- d2_lossPerc = (d2_loss / (d2_wins + d2_loss)) * 100;
- }
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << "Wins: " << d2_wins << " || %" << d2_winsPerc << endl;
- cout << "Loss: " << d2_loss << " || %" << d2_lossPerc << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- cout << "Coins: $" << avaCredits;
- amountDisplay();
- cout << endl;
- cout << "" << endl;
- credits();
- cout << " ____ " << endl;
- cout << " /\\' .\\ _____ " << endl;
- cout << " /: \\___\\ / . /\\ " << endl;
- cout << " \\' / . / /____/..\\ " << endl;
- cout << " \\/___/ \\' '\\ / " << endl;
- cout << " \\'__'\\/ " << endl;
- cout << " " << endl;
- cout << "[Player 1 rolls: " << p1_diceRoll << "]" << endl;
- cout << "[Player 2 rolls: " << p2_diceRoll << "]" << endl;
- cout << " " << endl;
- if (p1_diceRoll == p2_diceRoll) {
- cout << "You both roll the same number. its a tie!" << endl;
- }
- if (p1_diceRoll > p2_diceRoll) {
- cout << "Congratulations, you won the bet!" << endl;
- avaCredits = avaCredits - bet;
- avaCredits = avaCredits + (bet * 2);
- plusminus = "+";
- ++d2_wins;
- cout << " " << endl;
- cout << "Spoils = " << plusminus << " " << bet << endl;
- cout << " " << endl;
- }
- else {
- cout << "Sorry, you loss the bet!" << endl;
- avaCredits = avaCredits - bet;
- plusminus = "-";
- ++d2_loss;
- cout << " " << endl;
- cout << "Spoils = " << plusminus << " " << bet << endl;
- cout << " " << endl;
- }
- cout << "=============================================" << endl;
- cout << "Coins: " << "$" << avaCredits;
- amountDisplay();
- cout << endl;
- cout << "=============================================" << endl;
- cout << "Play Again? (y/n): ";
- cin >> again;
- } while (again == 'y');
- if (again == 'n') {
- PrintMenu();
- }
- }
- //Staking System
- void Play_Staking() {
- char again;
- do{
- string plusminus;
- int i = 0;
- int pid = 1 + (rand() % 2);
- for (int i = 0; i < 20; ++i) {
- p1_Hit[i] = (rand() % 25);
- p2_Hit[i] = (rand() % 25);
- p1_Str[i] = (rand() % 35);
- }
- cout << " __________________________________________ " << endl;
- cout << "<| ====== DUEL ARENA - Staking ====== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "Player 1 and Player 2 fight to the death." << endl;
- if (s_wins > 0 || s_loss > 0) {
- s_winsPerc = (s_wins / (s_wins + s_loss)) * 100;
- s_lossPerc = (s_loss / (s_wins + s_loss)) * 100;
- }
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << "Wins: " << s_wins << " || %" << s_winsPerc << endl;
- cout << "Loss: " << s_loss << " || %" << s_lossPerc << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- cout << "Coins: $" << avaCredits;
- amountDisplay();
- cout << endl;
- cout << "" << endl;
- credits();
- cout << " " << endl;
- cout << "(1) Player 1" << endl;
- cout << "(2) Player 2" << endl;
- cout << " " << endl;
- cout << "Bet on Player(?): ";
- cin >> choice;
- while (choice > 2 || choice == 0) {
- cout << "Invalid player choice, enter again: ";
- cin >> choice;
- }
- if (choice == 1) {
- player = "Player 1";
- }
- else if (choice == 2) {
- player = "Player 2";
- }
- cout << " " << endl;
- cout << " /\\ " << endl;
- cout << " _ )( ___________________________ " << endl;
- cout << "(_)///////(**)_______Fight!!!____________> " << endl;
- cout << " )( " << endl;
- cout << " \\/ " << endl;
- cout << " " << endl;
- if (pid == 1) {
- while (p1_HP > 0 && p2_HP > 0) {
- ++i;
- if (p1_HP > 0 && p2_HP > 0) {
- cout << "Player 1: Hits = " << left << setw(15) << p1_Hit[i] << "HP = " << p1_HP << endl;
- p2_HP = p2_HP - p1_Hit[i];
- }
- if (p1_HP > 0 && p2_HP > 0) {
- cout << "Player 2: Hits = " << left << setw(15) << p2_Hit[i] << "HP = " << p2_HP << endl;
- p1_HP = p1_HP - p2_Hit[i];
- }
- }
- }
- else if (pid == 2) {
- while (p1_HP > 0 && p2_HP > 0) {
- ++i;
- if (p1_HP > 0 && p2_HP > 0) {
- cout << "Player 2: Hits = " << left << setw(15) << p2_Hit[i] << "HP = " << p2_HP << endl;
- p1_HP = p1_HP - p2_Hit[i];
- }
- if (p1_HP > 0 && p2_HP > 0) {
- cout << "Player 1: Hits = " << left << setw(15) << p1_Hit[i] << "HP = " << p1_HP << endl;
- p2_HP = p2_HP - p1_Hit[i];
- }
- }
- }
- if (p1_HP <= 0) {
- cout << " " << endl;
- cout << "Player 1 DEFEATED with HP = " << p1_HP << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- if (choice == 2) {
- cout << "Congratulation, you won the bet!" << endl;
- avaCredits = avaCredits - bet;
- avaCredits = avaCredits + (bet * 2);
- winner = "Player 2";
- plusminus = "+";
- ++s_wins;
- }
- else if (choice == 1) {
- cout << "Sorry, you loss the bet!" << endl;
- avaCredits = avaCredits - bet;
- winner = "Player 1";
- plusminus = "-";
- ++s_loss;
- }
- }
- else if (p2_HP <= 0) {
- cout << " " << endl;
- cout << "Player 2 DEFEATED with HP = " << p2_HP << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- if (choice == 1) {
- cout << "Congratulation, you won the bet!" << endl;
- avaCredits = avaCredits - bet;
- avaCredits = avaCredits + (bet * 2);
- winner = "Player 1";
- plusminus = "+";
- ++s_wins;
- }
- else if (choice == 2) {
- cout << "Sorry, you loss the bet!" << endl;
- avaCredits = avaCredits - bet;
- winner = "Player 2";
- plusminus = "-";
- ++s_loss;
- }
- }
- cout << " " << endl;
- cout << "Winner = " << player << endl;
- cout << "Spoils = " << plusminus << " " << bet << endl;
- p1_HP = 99;
- p2_HP = 99;
- choice = 0;
- cout << " " << endl;
- cout << "=============================================" << endl;
- cout << "Coins: " << "$" << avaCredits;
- amountDisplay();
- cout << endl;
- cout << "=============================================" << endl;
- cout << "Play Again? (y/n): ";
- cin >> again;
- } while (again == 'y');
- if (again == 'n') {
- PrintMenu();
- }
- }
- void pause() {
- cout << "Press [Enter] to continue." << endl;
- cin.get();
- }
- //Cheat System
- void cheatCodes() {
- cout << " __________________________________________ " << endl;
- cout << "<| ======== Add Coins ======== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << "" << endl;
- cout << "Enter amount: ";
- cin >> stringamount;
- if (stringamount.find(str1)!= std::string::npos) {
- stringamount.replace(stringamount.find(str1),str1.length(),"000"); }
- if (stringamount.find(str2)!= std::string::npos) {
- stringamount.replace(stringamount.find(str2),str2.length(),"000000"); }
- if (stringamount.find(str3)!= std::string::npos) {
- stringamount.replace(stringamount.find(str3),str3.length(),"000000000"); }
- amountm = atoi(stringamount.c_str());
- avaCredits = avaCredits + amountm;
- cout << "[You successfully added '" << amountm << "' coins to your account]" << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- PrintMenu();
- }
- void PrintMenu()
- {
- int myChoice = 0;
- cout << " " << endl;
- cout << " __________________________________________ " << endl;
- cout << "<| ======== Main Menu ======== |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "(1): [Play] Dicing." << endl;
- cout << "(2): [Play] Dice Duel." << endl;
- cout << "(3): [Play] Staking." << endl;
- cout << "(4): [Add] Coins." << endl;
- cout << "(5): About." << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << " " << endl;
- cout << "Enter menu(?): ";
- cin >> myChoice;
- while (myChoice > 4 || myChoice == 0) {
- cout << "Invalid choice. Enter Menu(?): ";
- cin >> myChoice;
- }
- switch (myChoice)
- {
- case 1:
- Play_Dicing();
- break;
- case 2:
- Play_DiceDuel();
- break;
- case 3:
- Play_Staking();
- break;
- case 4:
- cheatCodes();
- break;
- case 5:
- cout << " __________________________________________ " << endl;
- cout << "<| Created by iSayChris - Version 0.95 Beta |>" << endl;
- cout << "<|__________________________________________|> " << endl;
- cout << " " << endl;
- cout << "Do you have what it takes to becomes the next Billionare?" << endl;
- cout << "Tip: You can use the k, m, and b amount multiplier." << endl;
- cout << " " << endl;
- cout << "---------------------------------------------" << endl;
- cout << "" << endl;
- myPause();
- PrintMenu();
- break;
- }
- }
- void myPause()
- {
- cout << "Press [Enter] to go back to Main Menu." << endl;
- cin.clear();
- cin.sync();
- cin.get();
- }
- int main()
- {
- cout << " " << endl;
- cout << "// Gambling Simulator 2015" << endl;
- cout << "// Created by iSayChris" << endl;
- cout << "// Version : BETA 0.5" << endl;
- srand(time(0));
- PrintMenu();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement