1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
galina1969 [7]
3 years ago
12

Define a function CoordTransform() that transforms the function's first two input parameters xVal and yVal into two output param

eters 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
using namespace std;
/* Your solution goes here */
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;
}

Computers and Technology
1 answer:
gogolik [260]3 years ago
4 0

Answer:

Here is the function CoordTransform() that transforms the function's first two input parameters xVal and yVal into two output parameters xValNew and yValNew

void CoordTransform (int xVal ,int yVal ,int& xValNew, int& yValNew) { //function definition

xValNew = (xVal +1) *2; // adds 1 to old value (xVal) , multiplies the result by 2 and assigns that new value to xValNew

yValNew = (yVal +1) *2; } // adds 1 to old value (yVal) , multiplies the result by 2 and assigns that new value to yValNew

Explanation:

Here is the complete program:

#include <iostream> //to use input output functions

using namespace std; // to access objects like cin cout

void CoordTransform (int xVal ,int yVal ,int& xValNew, int& yValNew) { //function that takes four arguments

xValNew = (xVal +1) *2; // computes new value and assigns it to xValNew

yValNew = (yVal +1) *2;} // computes new value and assigns it to yValNew

int main() { // start of main function

//declares 4 int type variables xValNew, yValNew, xValUser, yValUser

int xValNew;

int yValNew;

int xValUser;

int yValUser;

cin >> xValUser; // takes value of xValUser from user

cin >> yValUser; // takes value of yValUser from user

CoordTransform(xValUser, yValUser, xValNew, yValNew); //function call

cout << "(" << xValUser << ", " << yValUser << ") becomes (" << xValNew << ", " << yValNew << ")" << endl; //prints the old and new values

return 0;}

In this program the function CoordTransform receives a reference to a variables  xValNew and yValNew so that it can modify the values of these variables. So  xValNew and  yValNew variables are declared as reference so they become an alternative name for the variables xValNew and  yValNew used in main() method . These variables are declared as reference in the function CoordTransform() by placing ‘&’ symbol in the declaration.

Suppose user enters 3 as value of xValUser and 4 as  value of yValUser

Now when the function  CoordTransform() is called it works as follows:

xValNew = (xVal +1) *2; this statement becomes:

xValNew = (3 + 1) * 2

xValNew = 4 * 2

xValNew = 8

Now this value is assigned to the xValNew of calling function (main) xValNew variable.

yValNew = (yVal +1) *2;

this statement becomes:

yValNew = (4 + 1) * 2

yValNew = 5 * 2

yValNew = 10

Now this value is assigned to the yValNew of calling function (main) yValNew variable.

So the output of the above program is:

(3, 4) becomes (8, 10)          

You might be interested in
Is it more costly to Andrew to go to graduate business school full time or part time if the tuition is the same for each? A. Par
andrezito [222]

Answer:

A. Part time

Explanation:

Since tuition is the same whether he goes part time or full time, in the long run he will end up paying tuition a greater number of times if he is a part time student.

4 0
3 years ago
Read 2 more answers
Keegan has a hard drive that he wants to connect externally to his laptop. Which two ports can he connect the external hard driv
Marianna [84]

Answer:

,홀로 ㅛㅍㅍ 내 ㅍ. 냐 ㅑㅇㄹ ㅑ 덮고 ㅇ ㅗㅗ묙 ㅗㄴ ㄴ

Explanation:

소 묘 뉴 ㅕㅁ ㅣ 홈 ㅛ ㅑㅍㄴ. ㅕ 이 ㅕㅁ ㅛ ㅁ 포 ㅛ ㄴ ㅕ 여 あか

8 0
2 years ago
Company Wizzy is having trouble with network security. Issues with authentication, viruses, malware/spyware, and other network i
Darya [45]

Answer:

B) security as a service I'm just doing the work

4 0
3 years ago
"Memory refers to: A.the brain processes involved in the encoding, storage, and retrieval of information. B.the mechanisms drivi
natali 33 [55]

Answer: A

Explain:

you can use memory on a computer to retrieve passed data if your referring to brains memory that is memory of passed events

memory:1 the faculity by which the mind stores and members information

2 something remembered from the past a recollection

8 0
3 years ago
Which group on the Note Master tab contains the command to add footers to the notes pages?
nasty-shy [4]

Answer:

Place Holders

Explanation:

5 0
3 years ago
Other questions:
  • In excel what does sidney need to consider when creating formulas
    7·1 answer
  • What statement best decribes the relashionship bewteen science and technoligy?
    11·2 answers
  • Explain three applications of data mining
    14·1 answer
  • give an example of a technical issue you were not able to resolve on your first attempt. What troubleshooting steps did you take
    13·1 answer
  • A local variable that is declared as ____ causes the program to keep the variable and its latest value even when the function th
    10·1 answer
  • What is the major difference between the intranet and extranet?
    11·1 answer
  • A ____ is a a set of presentation rules that control how text should look. It is applied to an XML file to change the collection
    9·1 answer
  • If the tax percent is 15% and tax is $36 and percent discount is 10, what is the cost price?​
    12·1 answer
  • What is a computer please tell me ​
    10·2 answers
  • 8
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!