Answer:
#include <iostream>
#include <stdio.h>
using namespace std;
// create function called abDifference
void update(int *a,int *b) {
int r = *a;
#include <iostream>
#include <stdio.h>
using namespace std;
// create function called abDifference
void update(int *a,int *b) {
int r = *a;
*a = *a+*b;
*b = r-*b;
if(*b < 0)*b *= -1;
}
int main() {
int num1, num2;
cout<<"enter two ints"<<endl;
int *pa = &num1, *pb = &num2;
scanf("%d %d", &num1, &num2);
update(pa, pb);
cout<<num1<<endl;
cout<<num2<<endl;
return 0;
}
Explanation:
The function update does two things:
In the main method, the user is prompted to enter two ints. The method update() is called and passed the two ints. It prints the sum as num1 and the abs difference as num2