Advertisement
Guest User

Untitled

a guest
May 4th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstdlib>
  4. #include <ctime>
  5. #define MAX_SIZE 25
  6. #define ELEVEN 11
  7. //srand( time( NULL ) );
  8.  
  9. class Person
  10. {
  11. public:
  12. int age;
  13. std::string firstName,sureName;
  14. public:
  15. Person(){}
  16. Person(std::string f,std::string s,int a):age(a),firstName(f),sureName(s){}
  17.  
  18. };
  19.  
  20. class Rating
  21. {
  22. public:
  23. int defending, strength, shooting, expirence;
  24. int offensive(){
  25. return shooting*0,5+strength*0,3+expirence*0,2;
  26. }
  27. int defensive(){
  28. return defending*0,5+strength*0,3+expirence*0,2;
  29. }
  30. };
  31.  
  32. class Player: public Person, Rating
  33. {
  34. public:
  35. float value;
  36. int goals, assists;
  37. std::string position;
  38. public:
  39. Player(){}
  40. Player(std::string f,std::string s,std::string p, int a, float v, int g, int as):
  41. Person(f,s,a),position(p),value(v),goals(g),assists(as){}
  42. };
  43.  
  44. class Manager: public Person
  45. {
  46.  
  47. };
  48.  
  49. class Team: public Player
  50. {
  51. public:
  52. Player team[MAX_SIZE];
  53. Player eleven[ELEVEN];
  54. std::string name,stadium;
  55. int size;
  56. int place,budget,pts,goals,win,draw,lost,conceded;
  57. Team(std::string n, std::string s, Player* tab,int Tsize, int b):
  58. stadium(s), name(n),budget(b)
  59. {
  60. size = Tsize;
  61. conceded = 0;
  62. draw = 0;
  63. goals = 0;
  64. lost = 0;
  65. pts = 0;
  66. win = 0;
  67. for(int i=0;i<size;i++){
  68. team[i] = tab[i];
  69. }
  70. }
  71.  
  72. void Eleven(){
  73. if(size == ELEVEN){
  74. for(int i = 0; i < ELEVEN; i++){
  75. eleven[i] = team[i];
  76. }
  77. }
  78. else
  79. {
  80. std::cout << " Wybierz jedenastke meczowa: " << std::endl;
  81.  
  82. bool tab[size];
  83. for(int k = 0; k < size; k++){
  84. tab[k] = true;
  85. }
  86. for(int j = 1; j<ELEVEN;){
  87. for(int i = 0; i < size; i++)
  88. {
  89. if(tab[i]){
  90. std::string wybor;
  91. std::cout << team[i].firstName << " " << team[i].sureName << " (y/n) : ";
  92. std::cin >> wybor;
  93.  
  94. if(wybor == "y")
  95. {
  96. eleven[j] = team[i];
  97. j++;
  98. std::cout << j << std::endl;
  99. tab[i] = false;
  100. }
  101. }
  102. }
  103. }
  104. }
  105.  
  106. std::cout << " Wybrana jedynastka : ";
  107. for(int l = 0; l < ELEVEN; l++)
  108. {
  109. std::cout << eleven[l].sureName << ", ";
  110. }
  111. }
  112. /*int Match(Team Against){
  113. *
  114. int home, away;
  115. for(int i=0;i<11;i++){
  116. if(eleven[i].position == "F")
  117. }
  118.  
  119. }*/
  120.  
  121.  
  122. void add(Player P)
  123. {
  124. team[size] = P;
  125. size++;
  126. }
  127.  
  128. /*
  129. fstream plik;
  130. plik.open("druzyna.csv",ios::in);
  131.  
  132. if( plik.good() )
  133. {
  134. std::cout << "Plik został otwarty" << std::endl;
  135. int x = 1;
  136. int k = 0;
  137.  
  138. for (int i = 0; plik.eof()!=1; i++)
  139.  
  140. Druzyna[i] = new Player;
  141. if(x==1){
  142. getline(plik,Druzyna[i].,';');
  143. x++;
  144. }
  145. else{
  146. if(x==2){
  147. getline(plik,baza[k].nazwisko,';');
  148. x++;
  149. }
  150. else{
  151. if(x==3){
  152. getline(plik,baza[k].data,';');
  153. x++;
  154. }
  155. else{
  156. if(x==4){
  157. getline(plik,baza[k].mail,';');
  158. x++;
  159. }
  160. else{
  161. if(x==5){
  162. getline(plik,baza[k].wzrost,';');
  163. x++;
  164. }
  165. else{
  166. if(x==6){
  167. getline(plik,baza[k].telefon1,';');
  168. x++;
  169. }
  170. else{
  171. if(x==7){
  172. getline(plik,baza[k].telefon2,';');
  173. x++;
  174. }
  175. else{
  176. if(x==8){
  177. getline(plik,baza[k].telefon3,';');
  178. x++;
  179. }
  180. else{
  181. if(x==9){
  182. getline(plik,baza[k].plec);
  183. x = 1;
  184. k++;
  185.  
  186. }
  187. }
  188. }
  189. }
  190. }
  191. }
  192. }
  193. }
  194. }
  195. }
  196. plik.close();
  197. }
  198.  
  199. else
  200. { std::cout << "Nie udało się otworzyć pliku" << std::endl;
  201. }
  202. }*/
  203.  
  204. };
  205.  
  206. /*class Midfielder: public Player, public Rating
  207. * {
  208. int assisting, vision;
  209. };
  210.  
  211. class Goalkeeper: public Player{
  212. int goalkeeping, reaction;
  213. };
  214.  
  215. class Defender: public Player{
  216. int defending, interception;
  217. };
  218.  
  219. class Forward: public Player{
  220. int shooting, dribble;
  221. };*/
  222.  
  223. class Stats{};
  224.  
  225. class Match:public Team
  226. {
  227. int home,away;
  228. Team team1,team2;
  229. };
  230.  
  231. int main()
  232. {
  233. std::string wybor;
  234. while(wybor!="0"){
  235. std::cin >> wybor;
  236. Player p1("Mesut","Ozil","M",26,39,0,0);
  237. Player p2("Alexis","Sanchez","M",25,35,0,0);
  238. Player p3("Aaron","Ramsey","M",24,25,0,0);
  239. Player p4("Olivier","Giroud","F",26,20,0,0);
  240. Player p5("Santi","Cazorla","M",29,22,0,0);
  241. Player p6("Francis","Coquelin","M",23,11,0,0);
  242. Player p7("Gabriel","Paulista","D",24,11,0,0);
  243. Player p8("Laurent","Koscielny","D",27,18,0,0);
  244. Player p9("Nacho","Monreal","D",28,13,0,0);
  245. Player p10("Hector","Bellerin","D",20,5,0,0);
  246. Player p11("David","Ospina","G",29,8,0,0);
  247. Player tab[11]=
  248. {
  249. p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11
  250. } ;
  251. Team Arsenal("Arsenal","Emirates",tab,11,100);
  252. Player p12("Jack","Wilshere","M",24,22,0,0);
  253. Player p13("Theo","Walcott","M",26,22,0,0);
  254. Player p14("Alex","Oxlade-Chamberlain","M",21,17,0,0);
  255. Player p15("Mikel","Arteta","M",30,7,0,0);
  256. Arsenal.add(p12);
  257. Arsenal.add(p13);
  258. Arsenal.add(p14);
  259. Arsenal.add(p15);
  260.  
  261. std::cout << Arsenal.size << std::endl;
  262. std::cout << Arsenal.team[13].sureName << std::endl;
  263. Arsenal.Eleven();
  264. }
  265. return 0;
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement