Advertisement
Wow_Rasl

Untitled

Nov 28th, 2022
444
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.82 KB | None | 0 0
  1. #include <iomanip>
  2. #include <iostream>
  3. #include <string>
  4. #include <vector>
  5. #include <fstream>
  6. #include <algorithm>
  7. #include <ctime>
  8.  
  9. using namespace std;
  10.  
  11. class Person {
  12. public:
  13.     string name;
  14.     string surname;
  15.     Person();
  16.     Person(const string& a, const string& b) {
  17.         name_ = a;
  18.         surname_ = b;
  19.     }
  20.     void Show() {
  21.         std::cout << "Name: " << name << "\nSurname: " << surname << "\n";
  22.     }
  23. private:
  24.     string name_;
  25.     string surname_;
  26. };
  27.  
  28. class Gunslinger : virtual public Person {
  29. public:
  30.     Gunslinger() : Person() {};
  31.     Gunslinger(const string& a, const string& b, int cnt, int accure) : Person(a, b) {
  32.         count_ = cnt;
  33.         accuracy_ = accure;
  34.     };
  35.     double Draw() {
  36.         return accuracy_;
  37.     }
  38.    
  39.     void Show() {
  40.         std::cout <<"Name: " << name << "\nSurname: " << surname << "\n"
  41.             << "Competition count : " << count_ << "\n" << "Accuracy: " << accuracy_ << "\n";
  42.     }
  43. private:
  44.     int count_;
  45.     double accuracy_;
  46. };
  47.  
  48. class PokerPlayer : virtual public Person {
  49. public:
  50.     PokerPlayer() : Person() {};
  51.     PokerPlayer(const string& a, const string& b) : Person(a, b) {};
  52.     int Draw() {
  53.         srand(time(0));
  54.         return 1 + rand() % 52;
  55.     }
  56.     void Show() {
  57.         Person::Show();
  58.     }
  59. };
  60.  
  61. class BadDude : public Gunslinger, public PokerPlayer {
  62. public:
  63.     BadDude() : Person(), Gunslinger(), PokerPlayer() {};
  64.     BadDude(const string& a, const string& b, int gun_t) : Gunslinger(a, b, 0, 0), PokerPlayer(a, b), Person(a, b) {
  65.         gun_time = gun_t;
  66.     };
  67.     double Gdraw() {
  68.         return gun_time;
  69.     }
  70.     int Cdraw() {
  71.         return PokerPlayer::Draw();
  72.     }
  73.     void Show() {
  74.         Person::Show();
  75.     }
  76. private:
  77.     double gun_time;
  78. };
  79. int main() {
  80.     return 0;
  81. }
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement