Answer:
Here is the CoordTransform() function:
void CoordTransform(int xVal, int yVal, int &xValNew, int &yValNew){
xValNew = (xVal + 1) * 2;
yValNew = (yVal + 1) * 2; }
The above method has four parameters xVal and yVal that are used as input parameters and xValNew yValNew as output parameters. This function returns void and transforms its first two input parameters xVal and yVal into two output parameters xValNew and yValNew according to the formula: new = (old + 1) *
Here new variables are xValNew and yValNew and old is represented by xVal and yVal.
Here the variables xValNew and yValNew are passed by reference which means any change made to these variables will be reflected in main(). Whereas variables xVal and yVal are passed by value.
Explanation:
Here is the complete program:
#include <iostream>
using namespace std;
void CoordTransform(int xVal, int yVal, int &xValNew, int &yValNew){
xValNew = (xVal + 1) * 2;
yValNew = (yVal + 1) * 2;}
int main()
{ int xValNew;
int yValNew;
int xValUser;
int yValUser;
cin >> xValUser;
cin >> yValUser;
CoordTransform(xValUser, yValUser, xValNew, yValNew);
cout << "(" << xValUser << ", " << yValUser << ") becomes (" << xValNew << ", " << yValNew << ")" << endl;
return 0; }
The output is given in the attached screenshot