Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- dartscorer
- //Intro
- cout << "\nDarts Scorer!\n";
- //Oh One Darts Game Scorer
- ohone:
- int gamestart; //Start score
- string players; //Number of player
- //What is the start score
- startscore:
- cout << "\nWhat is the starting score?\n";
- cin >> gamestart;
- //How many people are playing
- players:
- cout << "\nHow many people are playing " << gamestart << "? (Max 4)\n";
- cin >> players;
- if (players!="1" && players!="2" && players!="3" && players!="4")
- cout << "\nThis program doesn't support more than 4 players";
- goto players;
- //What are the players names
- playername:
- string player1 = "";
- string player2 = "";
- string player3 = "";
- string player4 = "";
- if (players=="1") goto p1;
- if (players=="2") goto p2;
- if (players=="3") goto p3;
- if (players=="4") goto p4;
- p1:
- cout << "\n\nWhat is the name of Player 1?\n";
- cin >> player1;
- goto scoreboard;
- p2:
- cout << "\n\nWhat is the name of Player 1?\n";
- cin >> player1;
- cout << "What is the name of Player 2?\n";
- cin >> player2;
- goto scoreboard;
- p3:
- cout << "\n\nWhat is the name of Player 1?\n";
- cin >> player1;
- cout << "What is the name of Player 2?\n";
- cin >> player2;
- cout << "What is the name of Player 3?\n";
- cin >> player3;
- goto scoreboard;
- p4:
- cout << "\n\nWhat is the name of Player 1?\n";
- cin >> player1;
- cout << "What is the name of Player 2?\n";
- cin >> player2;
- cout << "What is the name of Player 3?\n";
- cin >> player3;
- cout << "What is the name of Player 4?\n";
- cin >> player4;
- goto scoreboard;
- //Scorecard and Entering Player Scores
- scoreboard:
- int player1throw = 0;
- int player2throw = 0;
- int player3throw = 0;
- int player4throw = 0;
- int player1score = gamestart - player1throw;
- int player2score = gamestart - player2throw;
- int player3score = gamestart - player3throw;
- int player4score = gamestart - player4throw;
- roll:
- if (players=="1") goto s1;
- if (players=="2") goto s2;
- if (players=="3") goto s3;
- if (players=="4") goto s4;
- //1 PLayer
- s1:
- cout << "\n\n" << player1 << "";
- cout << "\n" << player1score << "";
- cout << "\n\n" << player1 << " scored...\n";
- cin >> player1throw;
- player1score -= player1throw;
- if (player1score == 0)
- {cout << player1 << " Wins!!";
- goto rerun;}
- goto roll;
- //2 Players
- s2:
- cout << "\n\n" << player1 << " " << player2 << "";
- cout << "\n" << player1score << " " << player2score << "";
- cout << "\n\n" << player1 << " scored...\n";
- cin >> player1throw;
- player1score -= player1throw;
- if (player1score == 0)
- {cout << player1 << " Wins!!";
- goto rerun;}
- cout << "\n\n" << player1 << " " << player2 << "";
- cout << "\n" << player1score << " " << player2score << "";
- cout << "\n\n" << player1 << " " << player2 << "";
- cout << "\n\n" << player2 << " scored...\n";
- cin >> player2throw;
- player2score -= player2throw;
- if (player2score == 0)
- {cout << player2 << " Wins!!";
- goto rerun;}
- cout << "\n\n" << player1 << " " << player2 << "";
- cout << "\n" << player1score << " " << player2score << "";
- goto roll;
- //3 Players
- s3:
- cout << "\n\n" << player1 << " " << player2 << " " << player3 << "";
- cout << "\n" << player1score << " " << player2score << " " << player3score << "";
- cout << "\n\n" << player1 << " scored...\n";
- cin >> player1throw;
- player1score -= player1throw;
- if (player1score == 0)
- {cout << player1 << " Wins!!";
- goto rerun;}
- cout << "\n\n" << player1 << " " << player2 << " " << player3 << "";
- cout << "\n" << player1score << " " << player2score << " " << player3score << "";
- cout << "\n\n" << player2 << " scored...\n";
- cin >> player2throw;
- player2score -= player2throw;
- if (player2score == 0)
- {cout << player3 << " Wins!!";
- goto rerun;}
- cout << "\n\n" << player1 << " " << player2 << " " << player3 << "";
- cout << "\n" << player1score << " " << player2score << " " << player3score << "";
- cout << "\n\n" << player3 << " scored...\n";
- cin >> player3throw;
- player3score -= player3throw;
- if (player3score == 0)
- {cout << player3 << " Wins!!";
- goto rerun;}
- cout << "\n\n" << player1 << " " << player2 << " " << player3 << "";
- cout << "\n" << player1score << " " << player2score << " " << player3score << "";
- goto roll;
- //4 Players
- s4:
- cout << "\n\n" << player1 << " " << player2 << " " << player3 << " " << player4 << " ";
- cout << "\n" << player1score << " " << player2score << " " << player3score << " " << player4score << "";
- cout << "\n\n" << player1 << " scored...\n";
- cin >> player1throw;
- player1score -= player1throw;
- if (player1score == 0)
- {cout << player1 << " Wins!!";
- goto rerun;}
- cout << "\n\n" << player1 << " " << player2 << " " << player3 << " " << player4 << " ";
- cout << "\n" << player1score << " " << player2score << " " << player3score << " " << player4score << "";
- cout << "\n\n" << player2 << " scored...\n";
- cin >> player2throw;
- player2score -= player2throw;
- if (player2score == 0)
- {cout << player3 << " Wins!!";
- goto rerun;}
- cout << "\n\n" << player1 << " " << player2 << " " << player3 << " " << player4 << " ";
- cout << "\n" << player1score << " " << player2score << " " << player3score << " " << player4score << "";
- cout << "\n\n" << player3 << " scored...\n";
- cin >> player3throw;
- player3score -= player3throw;
- if (player3score == 0)
- {cout << player3 << " Wins!!";
- goto rerun;}
- cout << "\n\n" << player1 << " " << player2 << " " << player3 << " " << player4 << " ";
- cout << "\n" << player1score << " " << player2score << " " << player3score << " " << player4score << "";
- cout << "\n\n" << player4 << " scored...\n";
- cin >> player4throw;
- player4score -= player4throw;
- if (player4score == 0)
- {cout << player4 << " Wins!!";
- goto rerun;}
- goto roll;
- //Do you want to run the program again
- rerun:
- cout << "\n\nDo you want to run the program again? (y/n): ";
- string startagain;
- cin >> startagain;
- cout << "\n";
- if (startagain=="y") goto dartscorer; else goto close;
- close:
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement