Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iomanip>
- #include <iostream>
- #include <string>
- #include <vector>
- #include <fstream>
- #include <algorithm>
- #include <ctime>
- using namespace std;
- class Person {
- public:
- string name;
- string surname;
- Person();
- Person(const string& a, const string& b) {
- name = a;
- surname = b;
- }
- void Show() {
- std::cout << "Name: " << name << "\nSurname: " << surname << "\n";
- }
- };
- class Gunslinger : virtual public Person {
- public:
- Gunslinger() : Person() {};
- Gunslinger(const string& a, const string& b, int cnt, double accure) : Person(a, b) {
- count_ = cnt;
- accuracy_ = accure;
- };
- double Draw() {
- return accuracy_;
- }
- void Show() {
- std::cout << "Name: " << name << "\nSurname: " << surname << "\n"
- << "Competition count : " << count_ << "\n" << "Accuracy: " << accuracy_ << "\n";
- }
- private:
- int count_;
- double accuracy_;
- };
- class PokerPlayer : virtual public Person {
- public:
- PokerPlayer() : Person() {};
- PokerPlayer(const string& a, const string& b) : Person(a, b) {};
- int Draw() {
- srand(time(0));
- return 1 + rand() % 52;
- }
- void Show() {
- Person::Show();
- }
- };
- class BadDude : public Gunslinger, public PokerPlayer {
- public:
- BadDude() : Person(), Gunslinger(), PokerPlayer() {};
- BadDude(const string& a, const string& b, int gun_t) : Gunslinger(a, b, 0, 0), PokerPlayer(a, b), Person(a, b) {
- gun_time = gun_t;
- };
- double Gdraw() {
- return gun_time;
- }
- int Cdraw() {
- return PokerPlayer::Draw();
- }
- void Show() {
- Person::Show();
- std::cout << "Draw a weapon time: " << Gdraw() << endl;
- }
- private:
- double gun_time;
- };
- int main() {
- Person P("Rasul", "Gainutdinov");
- P.Show();
- Gunslinger Archer("Chel", "Chelov", 100, 77.1);
- Archer.Show();
- cout << Archer.Draw() << endl;
- PokerPlayer Player("a", "b");
- Player.Show();
- cout << Player.Draw() << endl;
- BadDude Doggie("Mr", "Cats", 20);
- Doggie.Show();
- cout << Doggie.Cdraw() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment