Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void menu() {
- system("cls");
- }
- int main() {
- cout << "Welcome to 5-10 game!" << endl << "In this game, you can add 5 or 10 to a specific number."<<endl<<"Your target is to reach 100 first. The game always starts with 0."<<endl<<"For example, you are provided with 50, in this case you can jump to 55 or 60."<<endl<<"Hope you enjoy the game! Best of luck"<<endl<<endl;
- int game;
- cout << "Press 1 to enter the game : ";
- cin >> game;
- menu();
- cout << "Press 1 for single player / ";
- cout << "Press 2 for multiplayers : ";
- int game_players;
- cin >> game_players;
- menu();
- if(game_players == 1) {
- cout << "Open first? Y/N : ";
- char opening;
- cin >> opening;
- menu();
- if(opening=='Y') {
- int x,y;
- while(1) {
- cin >> x;
- if(x==5) {
- y=10;
- cout<<y<<endl;
- }
- if(x==10) {
- y=15;
- cout<<y<<endl;
- }
- if(x==15) {
- y=20;
- cout<<y<<endl;
- }
- if(x==20) {
- y=30;
- cout<<y<<endl;
- }
- if(x==25) {
- y=30;
- cout<<y<<endl;
- }
- if(x==30) {
- y=40;
- cout<<y<<endl;
- }
- if(x==35) {
- y=40;
- cout<<y<<endl;
- }
- if(x==40) {
- y=45;
- cout<<y<<endl;
- }
- if(x==45) {
- y=55;
- cout<<y<<endl;
- }
- if(x==50) {
- y=55;
- cout<<y<<endl;
- }
- if(x==55) {
- y=60;
- cout<<y<<endl;
- }
- if(x==60) {
- y=70;
- cout<<y<<endl;
- }
- if(x==65) {
- y=70;
- cout<<y<<endl;
- }
- if(x==70) {
- y=75;
- cout<<y<<endl;
- }
- if(x==75) {
- y=85;
- cout<<y<<endl;
- }
- if(x==80) {
- y=85;
- cout<<y<<endl;
- }
- if(x==85) {
- y=90;
- cout<<y<<endl;
- }
- if(x==90) {
- y=100;
- cout<<y<<endl;
- cout<<"Sorry! You lose"<<endl;
- break;
- }
- if(x==95) {
- y=100;
- cout<<y<<endl;
- cout<<"Sorry! You lose"<<endl;
- }
- if(x==100) {
- cout<<"Congratulations! You win"<<endl;
- break;
- }
- }
- }
- else {
- int x,y=10;
- cout<<y<<endl;
- while(1) {
- cin>>x;
- if(x==15) {
- y=20;
- cout<<y<<endl;
- }
- if(x==20) {
- y=30;
- cout<<y<<endl;
- }
- if(x==25) {
- y=30;
- cout<<y<<endl;
- }
- if(x==30) {
- y=40;
- cout<<y<<endl;
- }
- if(x==35) {
- y=40;
- cout<<y<<endl;
- }
- if(x==40) {
- y=45;
- cout<<y<<endl;
- }
- if(x==45) {
- y=55;
- cout<<y<<endl;
- }
- if(x==50) {
- y=55;
- cout<<y<<endl;
- }
- if(x==55) {
- y=60;
- cout<<y<<endl;
- }
- if(x==60) {
- y=70;
- cout<<y<<endl;
- }
- if(x==65) {
- y=70;
- cout<<y<<endl;
- }
- if(x==70) {
- y=75;
- cout<<y<<endl;
- }
- if(x==75) {
- y=85;
- cout<<y<<endl;
- }
- if(x==80) {
- y=85;
- cout<<y<<endl;
- }
- if(x==85) {
- y=90;
- cout<<y<<endl;
- }
- if(x==90) {
- y=100;
- cout<<y<<endl;
- cout<<"Sorry! You lose"<<endl;
- break;
- }
- if(x==95) {
- y=100;
- cout<<y<<endl;
- cout<<"Sorry! You lose"<<endl;
- }
- if(x==100) {
- cout<<"Congratulations! You win"<<endl;
- break;
- }
- }
- }
- }
- else {
- char player1[100],player2[100];
- cout<<"Enter the first name of player 1 : ";
- scanf("%s",player1);
- cout<<"Enter the first name of player 2 : ";
- scanf("%s",player2);
- int x,y;
- printf("Who want to move first? Player 1(Press 1) or Player 2(Press 2) : ");
- int first_move;
- cin >> first_move;
- menu();
- for(int i=1 ; ; i++) {
- if(i%2!=0 && first_move==1) {
- printf("turn of %s : ",player1);
- cin>>x;
- if(x==100) {
- printf("%s wins",player1);
- break;
- }
- }
- else if(i%2==0 && first_move==1) {
- printf("turn of %s : ",player2);
- cin>>y;
- if(y==100) {
- printf("%s wins",player2);
- break;
- }
- }
- if(i%2!=0 && first_move==2) {
- printf("turn of %s : ",player2);
- cin>>x;
- if(x==100) {
- printf("%s wins",player2);
- break;
- }
- }
- else if(i%2==0 && first_move==2){
- printf("turn of %s : ",player1);
- cin>>y;
- if(y==100) {
- printf("%s wins",player1);
- break;
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement