You are viewing a single comment's thread. Return to all comments →
void SumAbs (int *a, int *b){ int temp = (*a); (*a)+=(*b);
temp = temp - (*b); if(temp>=0){ (*b)=temp; } else { (*b)=temp*(-1); }
}
int main() { int a, b; std::cin >> a >> b; SumAbs(&a,&b); std::cout << a << std::endl; std::cout << b << std::endl;
return 0;
Seems like cookies are disabled on this browser, please enable them to open this website
Pointer
You are viewing a single comment's thread. Return to all comments →
include
void SumAbs (int *a, int *b){ int temp = (*a); (*a)+=(*b);
}
int main() { int a, b; std::cin >> a >> b; SumAbs(&a,&b); std::cout << a << std::endl; std::cout << b << std::endl;
}