Sem2 Task1 reformatting

This commit is contained in:
Inex Code 2020-09-21 07:53:24 +00:00
parent f7abaa6d9d
commit e2b5149708

View file

@ -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;
}