include iostream include cassert include sstream using namespace std c

 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
42
43
44
#include <iostream>
#include <cassert>
#include <sstream>
using namespace std;
class ArrayF
{
public:
ArrayF() = delete;
ArrayF(int size);
ArrayF(const ArrayF& obj);
~ArrayF();
void print();
private:
int *arr;
int size;
};
ArrayF::ArrayF(int Size)
{
if (Size > 0) size = Size;
else throw - 1;
arr = new int[size];
for (int i = 0; i < size; i++);
arr[i] = rand() % 10;
}
void ArrayF::print()
{
for (int i = 0; i < size; i++)
cout « arr[i] « endl;
}
ArrayF::~ArrayF()
{
delete[]arr;
}
int main()
{
ArrayF a(10);
a.print();
}