Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValNew and yValNew is as shown as the code below
<h3>Explanation:
</h3><h3 />
Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValNew and yValNew.
The function returns void. The transformation is new = (old + 1) * 2.
Ex: If xVal = 3 and yVal = 4, then xValNew is 8 and yValNew is 10.
Prints:
(3,4) outputs (8,10)
(0,0) outputs (2,2)
Sample program:
#include using namespace std;int main() { int xValNew = 0; int yValNew = 0; CoordTransform(3, 4, xValNew, yValNew); cout << "(3, 4) becomes " << "(" << xValNew << ", " << yValNew << ")" << endl; return 0;}
Answer:
#include <iostream>
using namespace std;
<em>/ void CoordTransform(int *ptr1, int *ptr2);</em>
<em />
<em>int main()</em>
<em />
<em>{</em>
<em />
<em> int xVal;</em>
<em />
<em>int yVal;</em>
<em />
<em>cout<<"please enter two valid integers";</em>
<em />
<em>cin>>xVal;</em>
<em />
<em>cin>>yVal;</em>
<em />
<em>CoordTransform(&xVal , &yVal);</em>
<em />
<em>int xValNew=xVal;</em>
<em />
<em>int yValNew=yVal;</em>
<em />
<em>cout<<xValNew<<yValNew;</em>
<em />
<em> </em>
<em />
<em> return 0;</em>
<em />
<em>}</em>
<em />
<em>void CoordTransform(int *ptr1, int *ptr2)</em>
<em />
<em>{</em>
<em />
<em>int a = *ptr1;</em>
<em />
<em>*ptr1=(*ptr1+1)*2;</em>
<em />
<em>*ptr2=(*ptr2+1)*2;</em>
<em />
<em>}</em>
/
void CoordTransform (int xVal ,int yVal ,int& xValNew, int& yValNew) {
xValNew = (xVal +1) *2;
yValNew = (yVal +1) *2;
return;
}
int main() {
int xValNew = 0;
int yValNew = 0;
CoordTransform(3, 4, xValNew, yValNew);
cout << "(3, 4) becomes " << "(" << xValNew << ", " << yValNew << ")" << endl;
return 0;
<em>}</em>
Learn more about a function CoordTransform() brainly.com/question/13709447
#LearnWithBrainly