Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.12 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <ctime>
  4.  
  5. using namespace std;
  6.  
  7. //class Person {
  8. //public:
  9. //    Person(string name, string lastName) : mLastName(lastName), mName(name) {
  10. ////        cout << "My Name: " << mName << '\n';
  11. ////        cout << "My Surname: " << mLastName << '\n';
  12. //    }
  13. //
  14. //    ~Person() {
  15. ////        cout << "I'm out!" << '\n';
  16. //    }
  17. //
  18. //    virtual void printInfo() {
  19. //        cout << mName << ' ' << mLastName << '\n';
  20. //    }
  21. //
  22. //protected:
  23. //    string mName;
  24. //    string mLastName;
  25. //};
  26. //
  27. //class Worker : public Person {
  28. //public:
  29. //    Worker(string name, string surname, int salary, string jobTitle) : Person(name, surname), mSalary(salary), mJobTitle(jobTitle) {
  30. ////        cout << "I'm a " << mJobTitle << '\n';
  31. ////        cout << "I grind " << mSalary << '\n';
  32. //    }
  33. //
  34. //    ~Worker() {
  35. ////        cout << "I'm out as a worker!" << '\n';
  36. //    }
  37. //
  38. //    void printInfo() {
  39. //        cout << mName << ' ' <<  mLastName << ' ' <<  mSalary << ' ' <<  mJobTitle << '\n';
  40. //    }
  41. //
  42. //protected:
  43. //    int mSalary;
  44. //    string mJobTitle;
  45. //};
  46. //
  47. //void outerInfo(Person *person) {
  48. //    person->printInfo();
  49. //}
  50. //struct A {
  51. //    virtual void printOnes() {
  52. //        cout << "A";
  53. //    }
  54. //    virtual void printTwice() {
  55. //        cout << "AA";
  56. //    }
  57. //};
  58. //struct B : public A {
  59. //    void printOnes() {
  60. //        cout << "B";
  61. //    }
  62. //    void printTwice() {
  63. //        cout << "BB";
  64. //    }
  65. //};
  66. //void print(A &a) {
  67. //    a.printOnes();
  68. //    a.printTwice();
  69. //}
  70. //
  71. //class Animal {
  72. //public:
  73. //    virtual void makeSound() = 0;
  74. //};
  75. //
  76. //class Fish : public Animal {
  77. //public:
  78. //    void makeSound() override  {
  79. //        cout << "..." << '\n';
  80. //    }
  81. //};
  82. //class Fox : public Animal {
  83. //public:
  84. //    void makeSound() override  {
  85. //        cout << "Fr fr fr" << '\n';
  86. //    }
  87. //};
  88. //class Bear : public  Animal {
  89. //public:
  90. //    void makeSound() override  {
  91. //        cout << "Abrrrrrrr grararararararaaarara" << '\n';
  92. //    }
  93. //};
  94. //
  95. //void sound(Animal *animal) {
  96. //    animal->makeSound();
  97. //}
  98.  
  99. //class Enemy {
  100. //public:
  101. //    Enemy (string name, int health, int armour, int damage, double range) : mName(name), mHealth(health), mArmour(armour), mDamage(damage), mRange(range) {}
  102. //
  103. //    virtual void attack() = 0;
  104. //
  105. //protected:
  106. //    string mName;
  107. //    int mHealth;
  108. //    int mArmour;
  109. //    int mDamage;
  110. //    double mRange;
  111. //};
  112. //
  113. //class Creeper : public Enemy {
  114. //public:
  115. //    Creeper (string name, int health, int armour, int damage, double range) : Enemy(name, health, armour, damage, range) {}
  116. //
  117. //    void attack() override {
  118. //        cout << "Silently move to player" << '\n';
  119. //        cout << "Then BOOOOOOOOOOOOOOOOM!" << '\n';
  120. //    }
  121. //};
  122. //
  123. //class Skeleton : public Enemy {
  124. //public:
  125. //    Skeleton (string name, int health, int armour, int damage, double range) : Enemy(name, health, armour, damage, range) {
  126. //        if (rand() % 2 == 0) {
  127. //            mBow = "Common bow";
  128. //        } else {
  129. //            mBow = "127 lvl bow";
  130. //            mDamage *= 1000;
  131. //        }
  132. //    }
  133. //
  134. //    void attack() override {
  135. //        cout << "Shot at the player with " << mBow << "!!!" << '\n';
  136. //    }
  137. //
  138. //private:
  139. //    string mBow;
  140. //};
  141. //
  142. //Enemy *spawner() {
  143. //    Enemy *enemy = nullptr;
  144. //
  145. //    if (rand() % 2 == 0) {
  146. //        enemy = new Skeleton("s", 10, 0, 10, 100);
  147. //    } else {
  148. //        enemy = new Creeper("c", 10, 0, 100, 5);
  149. //    }
  150. //    return enemy;
  151. //}
  152.  
  153. int main() {
  154.     long double a = 1.123456789123456789;
  155.     cout << boolalpha << setbase(16) << 16 << ' ' << true << ' ' << false << '\n';
  156.     cout << setw(50) << setfill('#') << setprecision(19) << a;
  157. //    srand(time(nullptr));
  158. //
  159. //    for (int i = 0; i < 5; ++i) {
  160. //        Enemy *enemy = spawner();
  161. //        enemy->attack();
  162. //    }
  163. //    Fish fish;
  164. //    Fox fox;
  165. //    Bear bear;
  166. //
  167. //    sound(&fish);
  168. //    sound(&fox);
  169. //    sound(&bear);
  170.  
  171. //    Worker worker("Noname", "Untitled", 123, "None");
  172. //    outerInfo(&worker);
  173. //    A a;
  174. //    B b;
  175. //    print(b);
  176.  
  177. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement