blob: 6282c1d0f38f17bb6fcbce7b6b2a10e889f28cbb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <istream>
#include <ostream>
class NaturalNumbers {
char* name;
unsigned nameLength;
int* elements;
unsigned elementsCount;
unsigned elementsLength;
void copyFrom(const NaturalNumbers& other);
void free();
void move(NaturalNumbers&& other);
void resize();
int indexOfNum(int number) const;
public:
NaturalNumbers();
NaturalNumbers(const int* elements, unsigned elementsCount, const char* name);
~NaturalNumbers();
NaturalNumbers(const NaturalNumbers& other);
NaturalNumbers& operator=(const NaturalNumbers& other);
bool operator[](int number) const;
NaturalNumbers& operator+=(const NaturalNumbers& other);
const int* get_elements() const;
bool addElement(int number);
unsigned get_elementsCount() const;
const char* get_name() const;
void set_name(const char* newName);
};
NaturalNumbers operator+(const NaturalNumbers& lhs, const NaturalNumbers& rhs);
std::ostream& operator<<(std::ostream& ostr, const NaturalNumbers& numbers);
std::istream& operator>>(std::istream& istr, NaturalNumbers& numbers);
|