Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "fun.h"
- #include <conio.h>
- #include <cstdlib>
- #include <windows.h>
- using namespace std;
- int main(){
- Game Player;
- int ScoreX = 0;
- int ScoreO = 0;
- cout<<"PlayerX Score : "<<ScoreX<<"\t"<<"PlayerY Score : "<<ScoreO<<endl;
- cout<<endl;
- Player.PanelNum();
- cout<<endl;
- while((ScoreO < 10) && (ScoreX < 10)) {
- char playerX1 = 'X';
- char playerO1 = 'O';
- int numX;
- int numO;
- restart :
- if(ScoreX > 9) goto end;
- cout<<"Player X : ";
- if(!(cin>>numX)){
- cin.clear();
- cin.ignore();
- cout<<"Invaild numbers only between 1 - 9 "<<endl;
- goto restart;
- }
- if(numX > 9){
- cout<<"Invaild numbers only between 1 - 9 "<<endl;
- goto restart;
- }
- Game PlayerX(numX,playerX1,ScoreX);
- cout<<endl;
- system("cls");
- cout<<"PlayerX Score : "<<ScoreX<<"\t"<<"PlayerY Score : "<<ScoreO<<endl;
- cout<<endl;
- Player.PanelNum();
- cout<<endl;
- PlayerX.setup();
- if(PlayerX.status2()==true){
- goto restart;
- }
- PlayerX.win();
- if(PlayerX.status5()==true){
- goto restart;
- }
- ScoreX = PlayerX.Scores();
- if(PlayerX.status1()==true){
- goto restart;
- }
- cout<<endl;
- start :
- if(ScoreO > 9) goto end;
- cout<<"Player Y : ";
- if(!(cin>>numO)){
- cin.clear();
- cin.ignore();
- cout<<"Invaild numbers only between 1 - 9 "<<endl;
- goto start;
- }
- Game PlayerO(numO,playerO1,ScoreO);
- if(numO > 9){
- cout<<"Invaild numbers only between 1 - 9 "<<endl;
- goto start;
- }
- cout<<endl;
- system("cls");
- cout<<"PlayerX Score : "<<ScoreX<<"\t"<<"PlayerY Score : "<<ScoreO<<endl;
- cout<<endl;
- Player.PanelNum();
- cout<<endl;
- PlayerO.setup();
- if(PlayerO.status2()==true){
- goto start;
- }
- PlayerO.win();
- if(PlayerO.status5()==true){
- goto start;
- }
- ScoreO = PlayerO.Scores();
- if(PlayerO.status1()==true){
- goto start;
- }
- cout<<endl;
- }
- end :
- Sleep(250);
- system("cls");
- system("color 28");
- if(ScoreX > ScoreO && (ScoreX+ScoreO) >= 10)
- cout<<"Player X won the game.."<<endl;
- if(ScoreX < ScoreO && (ScoreX+ScoreO) >= 10)
- cout<<"Player Y won the game.."<<endl;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement