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
Mila [183]
3 years ago
7

Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValN

ew 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.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;}
Computers and Technology
2 answers:
Ugo [173]3 years ago
5 0

Answer:

The following program is written in C++ Programming Language:

//header file

#include <iostream>

using namespace std; //using namespace

//set void type method

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

xValNew = (xVal +1) *2;

 //here is the code

yValNew = (yVal +1) *2;

 //

return;

}

//main method

int main() {

int xValNew = 0;

 // initialize integer type variable

int yValNew = 0;

 // initialize integer type variable

CoordTransform(3, 4, xValNew, yValNew);

 // method definition

// print result

cout << "(3, 4) becomes " << "(" << xValNew << ", " << yValNew << ")" << endl;

return 0;

 //return

}

Explanation:

In the following program, we can set the header file or using namespace.

Then, set void type function which is given in the question and write the following codes and close the function.

Then, set the main method, inside it, we initialize two integer type variable to 0.

Then, call the function and pass the value through the parameter.

elena-14-01-66 [18.8K]3 years ago
5 0

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

You might be interested in
What were the technological innovations that allowed for the rapid expansion of the railroads?
liraira [26]

Answer:

There are different phases of railroad expansion with the innovations in technology.

Explanation:

Few of the technological innovations are described below that leads in railroad expansion more rapid.

1. Centralized Traffic control (CTC) is introduced in 1960's that is used to control the traffic on railroads using different signal control.

2. In 1990's after computer technology involvement, railway ticket and reservation system is automate and being centralized. That makes the railroad expansion improve.

3. Bullet train technology has been introduced, that makes the railway trains more faster.

4. Electric trains has been introduced to use green energy and reduce the dependency on the fuel to make environment clean and green.

5 0
2 years ago
Which of the following is true about operating system.
zalisa [80]

Answer:

google kis kam ka hai us se puch lo

7 0
2 years ago
The keyboard shortcut to save a file is _______.<br><br> Ctrl-s
asambeis [7]
Yes its Ctrl + S and if you want to save as press F12
8 0
3 years ago
Any thoughts to the answer
zhenek [66]
Cools the engine oil, thsts what I think, but not sure bc u would cool the engine, and it's a fan
4 0
3 years ago
Read 2 more answers
Whats a good way to remember to log out
Gemiola [76]
You just need to set a reminder on your phone and try and remember

3 0
3 years ago
Other questions:
  • Describe how using active listening at work can help you be a better employee.
    15·1 answer
  • Read each statement below. If the statement describes a peer-to-peer network, put a P next to it. If the statement describes a s
    13·2 answers
  • In controlling network traffic to minimize slow-downs, a technology called ________ is used to examine data files and sort low-p
    15·1 answer
  • What is ucspi-tcp pakage in qmail??
    5·1 answer
  • To print a range of cells in the active worksheet, click ____ in the settings area in the print gallery.
    14·1 answer
  • State why hexadecimal is used to display the error code
    11·1 answer
  • How do u know when a website doesnt like u?
    11·1 answer
  • Which 3D game has Bentley the Bear collect gems while avoiding enemy trees, bees, ghosts, skeletons, and Berthilda the witch?
    9·1 answer
  • Document accurately describes the differences between servers and computers and between local and wide area networks. Document p
    5·1 answer
  • 1)What is the hydropower resources/energy?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!