Advertisement
Norvager

Демонический массив

Jan 14th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. class demon{
  7. private:
  8.     bool status;
  9.     int HP;
  10.     int DMG;
  11.     int DDG;
  12.     int DEF;
  13. public:
  14.     demon(){
  15.         status = true;
  16.         cout << "This demon is REAL!!!" << endl;
  17.     }
  18.     void input_data();
  19.     void show_data();
  20.     void die();
  21.     void ressurection();
  22. };
  23.  
  24. void demon::input_data(){
  25.     cout << "Enter HP your demon: ";
  26.     cin >> this->HP;
  27.     cout << "Enter DMG your demon: ";
  28.     cin >> this->DMG;
  29.     cout << "Enter DDG your demon: ";
  30.     cin >> this->DDG;
  31.     cout << "Enter DEF your demon: ";
  32.     cin >> this->DEF;
  33. }
  34.  
  35. void demon::show_data(){
  36.     cout << "HP your demon: " << this->HP << endl;
  37.     cout << "DMG your demon: " << this->DMG << endl;
  38.     cout << "DDG your demon: " << this->DDG << endl;
  39.     cout << "DEF your demon: " << this->DEF << endl;
  40. }
  41.  
  42. void demon::die(){
  43.     if (this->HP == 0){
  44.         this->status = false;
  45.         cout << "Pomerla sila nechistaya!" << endl;
  46.     }
  47. }
  48.  
  49. void demon::ressurection(){
  50.  
  51. }
  52.  
  53. int main(){
  54.     vector<demon> demons;
  55.     int a;
  56.     demon lox;
  57.     do{
  58.         cin >> a;
  59.         switch (a){
  60.         case 1: lox.input_data();
  61.             demons.push_back(lox);
  62.             break;
  63.         case 2: int b;
  64.             cout << "Enter id your demon's: ";
  65.             cin >> b;
  66.             if (b > demons.size()){
  67.                 cout << "You debil!!!";
  68.                 break;
  69.             }
  70.             demons[b]
  71.         }
  72.     } while (a != 0)
  73.     system("pause");
  74.     return 0;
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement