Guest User

Untitled

a guest
May 22nd, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <time.h>
  3. #include <conio.h>
  4. #include <windows.h>
  5. #include "colours.h"
  6. #include <fstream>
  7. #include <ctime>
  8. #include <dos.h>
  9. #include <stdio.h>
  10. #include "Team.h"
  11.  
  12. using namespace std;
  13.  
  14. //Type Settings
  15.  
  16. //Enumerated Types
  17.  
  18. //Prototypes
  19. void sleep(int mseconds);
  20.  
  21.  
  22. int main()
  23. {
  24. int team1 = 1;
  25. Team * team[2];
  26. int i;
  27. int ii;
  28. int teamScore[2];
  29. // Seed the random number generator use the timer
  30. srand( (unsigned)time( NULL ) );
  31. for (i=0; i<rand(); i++)
  32.       rand();
  33.  
  34. teamScore[0] = 0;
  35. teamScore[1] = 0;
  36.  
  37.  
  38. text_colour(f_yellow, b_black);
  39. cout<<"BASKETBALL GAME "<<endl;
  40.  
  41. for (i=0; i<2; i++)
  42.     team[i] = new Team(i);
  43.  
  44. for (i=0; i<4; i++)
  45. {
  46.     text_colour(f_yellow, b_black);
  47.     cout<<"QUARTER "<<i+1<<": "<<endl;
  48.     for (ii=0; ii<30; ii++)
  49.     {
  50.         text_colour(f_cyan, b_black);
  51.         teamScore[0] = team[0]->PlayQuarter();
  52.         sleep(400);
  53.         text_colour(f_magenta, b_black);
  54.         teamScore[1] = team[1]->PlayQuarter();
  55.         sleep(400);
  56.         text_colour(f_green, b_black);
  57.         cout<<endl;
  58.         cout<<"CURRENT SCORE: "<<endl;
  59.         cout<<" Team ";team[0]->TeamName();cout<<"'s Score - "<<teamScore[0]<<endl;
  60.         cout<<" Team ";team[1]->TeamName();cout<<"'s Score - "<<teamScore[1]<<endl;
  61.         cout<<endl;
  62.         sleep(500);
  63.     }
  64. }
  65.  
  66. text_colour(f_white, b_black);
  67. cout<<"FINAL RESULTS: "<<endl;
  68. if (teamScore[0] > teamScore[1])
  69. {
  70.     cout<<" Team ";team[0]->TeamName();cout<<"is victorious with a score of "<<teamScore[0]<<endl;
  71. }
  72.  
  73. for (i=0; i<2; i++)
  74.     team[i]->PrintTeamStats();
  75.  
  76.  
  77.    
  78.  
  79.  
  80.  
  81. return 0;
  82. }
  83.  
  84.  
  85.  
  86.  
  87.  
  88. void sleep(int mseconds)
  89. {
  90.     clock_t goal = mseconds + clock();
  91.     while (goal > clock());
  92. }
Add Comment
Please, Sign In to add comment