Untitled

 avatar
unknown
c_cpp
3 years ago
999 B
5
Indexable
//ФАЙЛ Shooter.h

#pragma once
#include "iostream"

using namespace std;

class Shooter {
private:
    int* shooterPrecisions{}; //влучності стрільця
    int size = 10;
public:
    //Конструктор за замовчуванням
    Shooter() {
        this->shooterPrecisions = nullptr;
    }
    //Конструктор
    explicit Shooter(const int* shooterPrecision) {
        for (int i = 0; i < size; ++i) {
            this->shooterPrecisions[i] = shooterPrecision[i];
        }
    }
    //Ввести імовірності попадання стрільця
    void SetShooterPrecisions() {
        cout << "Input probabilities that SHOOTER will hit the target: " << endl;
        for (int i = 0; i < size; ++i) {
            cout << i + 1<< ": ";
            cin >> shooterPrecisions[i];
        }
    }

    int *getShooterPrecisions() const {
        return shooterPrecisions;
    }

    ~Shooter() {
        delete[] this->shooterPrecisions;
    }
};
Editor is loading...