Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class LottoNumbers {
- private:
- int *t;
- int size;
- public:
- LottoNumbers(int x) {
- size = 6; // kurwa chuj.
- t = new int[size];
- for (int i = 1; i <= size; i++) {
- t[i-1] = x + i;
- }
- }
- ~LottoNumbers() {
- delete[] t;
- }
- LottoNumbers &operator = (LottoNumbers &x) {
- delete[] t;
- size = x.size;
- t = new int[size];
- for (int i = 0; i < size; i++) {
- t[i] = x.t[i];
- };
- }
- int * LottoNumbers::operator [] (int i) {
- return &t[i];
- }
- int min() {
- int min;
- min = t[0];
- for (int i = 1; i < size; i++) {
- if (t[i] < min) min = t[i];
- }
- return min;
- }
- friend std::istream &operator >> (std::istream &c, LottoNumbers &x) {
- for (int i = 0; i < size; i++) {
- c >> t[i];
- }
- return c;
- }
- };
- class ExLottoNumbers : LottoNumbers {
- public:
- char numtype;
- };
- int main() {
- LottoNumbers x(20);
- std::string a;
- std::cout << *x [0];
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement