Answer to Question #328855 in C++ for Program Training

Question #328855

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. 


1
Expert's answer
2022-04-17T07:41:23-0400
#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);


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS