Sem2 Task1 reformatting
This commit is contained in:
parent
f7abaa6d9d
commit
e2b5149708
|
@ -42,19 +42,23 @@ public:
|
|||
}
|
||||
cout << "\n";
|
||||
}
|
||||
DynArr operator+ (const DynArr& second) {
|
||||
DynArr operator+(const DynArr& second)
|
||||
{
|
||||
DynArr result(second);
|
||||
uint target_size = size;
|
||||
if (second.size < size) target_size = second.size;
|
||||
if (second.size < size)
|
||||
target_size = second.size;
|
||||
for (uint i = 0; i < target_size; i++) {
|
||||
result.set(i, result.get(i) + arr[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
DynArr operator- (const DynArr& second) {
|
||||
DynArr operator-(const DynArr& second)
|
||||
{
|
||||
DynArr result(second);
|
||||
uint target_size = size;
|
||||
if (second.size < size) target_size = second.size;
|
||||
if (second.size < size)
|
||||
target_size = second.size;
|
||||
for (uint i = 0; i < target_size; i++) {
|
||||
result.set(i, arr[i] - result.get(i));
|
||||
}
|
||||
|
@ -117,6 +121,5 @@ int main()
|
|||
(arr + arr2).print();
|
||||
cout << "Первый - второй:\n";
|
||||
(arr - arr2).print();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue