Define a function CoordTransform() that transforms the function's 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.
#include<iostream>
using namespace std;
void CoordTransform(float xVal, float yVal)
{
int newX = (xVal + 1) * 2;
int newY = (yVal + 1) * 2;
cout << "New value of x is " << newX;
cout << "\nNew value of y is " << newY;
}
int main()
{
CoordTransform(3, 4);
float x, y;
cout << "\nPlease, enter values of x and y: ";
cin >> x >> y;
CoordTransform(x, y);
}
Comments
Leave a comment