Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <conio.h>
- #include <windows.h>
- #include "colours.h"
- #include <fstream>
- #include <ctime>
- #include <dos.h>
- #include <stdio.h>
- #include "Team.h"
- using namespace std;
- //Type Settings
- //Enumerated Types
- //Prototypes
- void sleep(int mseconds);
- int main()
- {
- int team1 = 1;
- Team * team[2];
- int i;
- int ii;
- int teamScore[2];
- // Seed the random number generator use the timer
- srand( (unsigned)time( NULL ) );
- for (i=0; i<rand(); i++)
- rand();
- teamScore[0] = 0;
- teamScore[1] = 0;
- text_colour(f_yellow, b_black);
- cout<<"BASKETBALL GAME "<<endl;
- for (i=0; i<2; i++)
- team[i] = new Team(i);
- for (i=0; i<4; i++)
- {
- text_colour(f_yellow, b_black);
- cout<<"QUARTER "<<i+1<<": "<<endl;
- for (ii=0; ii<30; ii++)
- {
- text_colour(f_cyan, b_black);
- teamScore[0] = team[0]->PlayQuarter();
- sleep(400);
- text_colour(f_magenta, b_black);
- teamScore[1] = team[1]->PlayQuarter();
- sleep(400);
- text_colour(f_green, b_black);
- cout<<endl;
- cout<<"CURRENT SCORE: "<<endl;
- cout<<" Team ";team[0]->TeamName();cout<<"'s Score - "<<teamScore[0]<<endl;
- cout<<" Team ";team[1]->TeamName();cout<<"'s Score - "<<teamScore[1]<<endl;
- cout<<endl;
- sleep(500);
- }
- }
- text_colour(f_white, b_black);
- cout<<"FINAL RESULTS: "<<endl;
- if (teamScore[0] > teamScore[1])
- {
- cout<<" Team ";team[0]->TeamName();cout<<"is victorious with a score of "<<teamScore[0]<<endl;
- }
- for (i=0; i<2; i++)
- team[i]->PrintTeamStats();
- return 0;
- }
- void sleep(int mseconds)
- {
- clock_t goal = mseconds + clock();
- while (goal > clock());
- }
Add Comment
Please, Sign In to add comment