Sem2 task1 fix size bug
This commit is contained in:
parent
37c86de8ad
commit
126e8e2e0f
|
@ -66,13 +66,16 @@ public:
|
||||||
}
|
}
|
||||||
DynArr(uint dsize)
|
DynArr(uint dsize)
|
||||||
{
|
{
|
||||||
arr = new int(dsize);
|
arr = new int[dsize];
|
||||||
size = dsize;
|
size = dsize;
|
||||||
|
for (uint i = 0; i < size; i++) {
|
||||||
|
arr[i] = rand() % 100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DynArr(const DynArr& original)
|
DynArr(const DynArr& original)
|
||||||
{
|
{
|
||||||
size = original.size;
|
size = original.size;
|
||||||
arr = new int(original.size);
|
arr = new int[original.size];
|
||||||
memcpy(arr, original.arr, sizeof(int) * size);
|
memcpy(arr, original.arr, sizeof(int) * size);
|
||||||
}
|
}
|
||||||
~DynArr()
|
~DynArr()
|
||||||
|
|
Loading…
Reference in a new issue