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
gulaghasi [49]
3 years ago
6

7.8.1: Function pass by reference: Transforming coordinates. Define a function CoordTransform() that transforms the function's f

irst 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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #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; } 1 test passed All tests passed Run Feedback? How was this section?

Computers and Technology
1 answer:
Lilit [14]3 years ago
7 0

Answer:

Here is the CoordTransform() function:              

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

xValNew = (xVal + 1) * 2;

yValNew = (yVal + 1) * 2; }

The above method has four parameters xVal  and yVal that are used as input parameters and xValNew yValNew as output parameters. This function returns void and transforms its first two input parameters xVal and yVal into two output parameters xValNew and yValNew according to the formula: new = (old + 1) *

Here new variables are xValNew  and yValNew and old is represented by xVal and yVal.

Here the variables xValNew and yValNew are passed by reference which means any change made to these variables will be reflected in main(). Whereas variables xVal and yVal are passed by value.

Explanation:

Here is the complete program:

#include <iostream>

using namespace std;

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

xValNew = (xVal + 1) * 2;

yValNew = (yVal + 1) * 2;}

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; }

The output is given in the attached screenshot   

You might be interested in
On the line below, write the two places you can control tab settings.
nikklg [1K]

The two places you can control tab settings are the  ruler and in the dialog box.

<h3>What are setting tabs?</h3>

The Ctrl + Tab is one that is often referred to as Control Tab and C-tab or the Ctrl+Tab.

It is known to be a keyboard shortcut that is said to be most often used to chose between open tabs in a browser.

Note that the settings Tabs are said to be a kind of paragraph-formatting tool that is often used to align text.

Hence, The two places you can control tab settings are the  ruler and in the dialog box.

Learn more about control tab settings from

brainly.com/question/11509892

#SPJ1

See full question below

Where can’t you control tab settings? Check all the apply

On a ruler

In a dialog box

In the mini toolbar

In the paste special options

4 0
1 year ago
Consider the following program segment. ifstream inFile; //Line 1 int x, y; //Line 2 ... //Line3 inFile &gt;&gt; x &gt;&gt; y; /
AnnyKZ [126]

Answer:

inFile.open("progdata.dat");

Explanation:

5 0
3 years ago
The process known as "bitmapping" is defined as information in _____. <br><br> finish the sentence.
valentina_108 [34]

graphics is the answer

4 0
3 years ago
When an attacker presents a program or himself as someone else to obtain private information and pretends to be a legitimate web
timofeeve [1]
A spoofing attack. "<span>a situation in which one person or program successfully masquerades as another by falsifying data, thereby gaining an illegitimate advantage."</span>
8 0
3 years ago
To change the numbering style for a page number or to specify a number to use as the first page number, _____ should be clicked
Oksi-84 [34.3K]

Answer:

Format Page Number

Explanation:

In order to change the numbering style for  page number or to choose the numbering position or to specify the number to begin with, following the following steps:

a. Go to Insert tab

b. Go to Header & Footer section

c. Click the dropdown icon beside Page Number

d. Select Format Page Number.

7 0
3 years ago
Other questions:
  • ____ is the name of a particularly nasty automated program that attacks a network by exploiting Internet Protocol (IP) broadcast
    15·1 answer
  • You are testing a web application for sql injection vulnerabilities. you send various sql statements which return results on the
    5·1 answer
  • As a member of the accounting group,
    10·1 answer
  • The continue statement _________.
    11·1 answer
  • Is iPhone better than android
    12·2 answers
  • What is the primary way to access applications in window 10
    7·1 answer
  • Assignment 4: Evens and Odds<br><br><br> How do I fix this?
    13·1 answer
  • Write a program that will generate a personalized invitation within a text file for each guest in the guest list file using the
    15·1 answer
  • Place the steps in order for creating a Custom Search Folder in Outlook 2016.
    9·2 answers
  • TIMED QUIZ
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!