czlowiekzgon

Untitled

Nov 15th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <string>
  4. #include "Gang.h"
  5.  
  6. using namespace std;
  7.  
  8. Gang::Gang()
  9. {
  10. cout << "podaj nazwe grupy : ";
  11. cin >> name_gang;
  12. cout << "podaj imie bossa : ";
  13. cin >> name_boss;
  14.  
  15. cout << "podaj date zalozenia organizacji : ";
  16. string yr;
  17. cin >> yr;
  18. while (!atoi(yr.c_str()) && yr != "0") {
  19. cout << "podany rok nie jest liczba " << endl;
  20. cin >> yr;
  21. }
  22. year = atoi(yr.c_str());
  23.  
  24. cout << "Podaj liczbe zabojcow : ";
  25. cin >> sizeAssassin;
  26. ptrAssassin = new Assassin[sizeAssassin];
  27.  
  28. }
  29.  
  30. Gang::~Gang() {
  31. for ( int i = 0; i < sizeAssassin; i++) {
  32. ptrAssassin[i].~Assassin();
  33. }
  34. delete[] ptrAssassin;
  35. ptrAssassin = nullptr;
  36. }
  37.  
  38.  
  39. Gang::Gang(string name_ga, string name_bo, string yr)
  40. {
  41. name_gang = name_ga;
  42.  
  43. name_boss = name_bo;
  44. while (!atoi(yr.c_str()) && yr != "0") {
  45. cout << "podany rok nie jest liczba " << endl;
  46. cin >> yr;
  47. }
  48. year = atoi(yr.c_str());
  49. }
  50.  
  51.  
  52.  
  53. void Gang::init() {
  54.  
  55. cout << "podaj nazwe grupy : ";
  56. cin >> name_gang;
  57. cout << "podaj imie bossa : ";
  58. cin >> name_boss;
  59.  
  60. cout << "podaj date zalozenia organizacji : ";
  61. string yr;
  62. cin >> yr;
  63. while (!atoi(yr.c_str()) && yr != "0") {
  64. cout << "podany rok nie jest liczba " << endl;
  65. cin >> yr;
  66. }
  67. year = atoi(yr.c_str());
  68.  
  69.  
  70. }
  71.  
  72.  
  73.  
  74. void Gang::init(string name_ga, string name_bo, string yr) {
  75.  
  76. name_gang = name_ga;
  77.  
  78. name_boss = name_bo;
  79.  
  80. while (!atoi(yr.c_str()) && yr != "0") {
  81. cout << "podany rok nie jest liczba " << endl;
  82. cin >> yr;
  83. }
  84. year = atoi(yr.c_str());;
  85.  
  86.  
  87.  
  88. }
  89.  
  90. void Gang::show() {
  91. if (this != nullptr) {
  92. cout << "Nazwa organizacji : " << name_gang << endl;
  93. cout << "Boss : " << name_boss << endl;
  94. cout << "Rok zalozenia : " << year << endl;
  95. }
  96.  
  97. }
Add Comment
Please, Sign In to add comment