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
kobusy [5.1K]
4 years ago
6

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.
Computers and Technology
2 answers:
Svetradugi [14.3K]4 years ago
8 0

Answer:

#include <iostream>

using namespace std;

void CoordTransform(int *xVal, int *yVal) {

// since we have passed x and y by adress:

// any change in xVal or yVal will also change the value of x and y

*xVal = (*xVal + 1) * 2;

*yVal = (*yVal + 1) * 2;

}

int main() {

int x, y;

// geting x from user

cout << "Enter x: ";

cin >> x;

// getting y from user

cout << "Enter y: ";

cin >> y;

// passing x and y to function CoordTransform() by adress.

CoordTransform(&x, &y);

cout << "new x: " << x << endl;

cout << "new y: " << y << endl;

return 0;

}

Explanation:

a pointer points to a memory location of the veraible so, when we pass a veriable by adress to a function, any change at that memory location also effect the value of the veriable that is local to the calling function.  

NISA [10]4 years ago
3 0

Answer:

#include <iostream>

using namespace std;

void CoordTransform(int *ptr1, int *ptr2);

int main()

{

   int xVal;

int yVal;

cout<<"please enter two valid integers";

cin>>xVal;

cin>>yVal;

CoordTransform(&xVal , &yVal);

int xValNew=xVal;

int yValNew=yVal;

cout<<xValNew<<yValNew;

   

   return 0;

}

void CoordTransform(int *ptr1, int *ptr2)

{

int a = *ptr1;

*ptr1=(*ptr1+1)*2;

*ptr2=(*ptr2+1)*2;

}

Explanation:

It will return new values in previously defined variables

coding language: c++

You might be interested in
A TCP entity opens a connection and uses slow start. Approximately how many round-trip times are required before TCP can send N
DedPeter [7]

Answer:

Round trip times required =  log2N

Explanation:

The round-trip times required before TCP can send N segments using a slow start is log2N. we can arrive at this by looking at the mode of operation of TCP which is  at the 1st time of using a TCP it starts the congestion window as 1 then it  sends an initial segment. When the acknowledgement of the initial segment arrives, TCP increases the congestion window to 2 and then sends 2 segments, When the 2 acknowledgements of the segments sent out arrives, they each increase the congestion window by one, thereby increasing the congestion window to 4 . therefore it takes   log2N round trips before TCP can send N segments

3 0
3 years ago
Can someone please give me Python test 3 it would help me tremendously
Ket [755]

Question 1:  To tell what will happen when an if-statement is false.

Question 2: The = should be ==

                    elseif should be elif

                    The else should have a :

Question 3: All algorithms can only do number calculations.  

Question 4: and

Question 5: To make a follow-up True/ False decision

Question 6: if (text1 > 15):

Question 7: if (text1 == 78):

Question 8: if (num1 != num2):

Question 9: >=

Question 10: 4

Question 11: 3

Question 18: a < b and a != b  

Question 19: !=

Sorry about 12 - 17 and 20 i can't seem to find those questions guessing you wanted edhesive. I dont have an account on it.

5 0
3 years ago
How to fix my pc from this
Ray Of Light [21]

Answer:

Restart it

Explanation:

6 0
3 years ago
Read 2 more answers
WHAT ARE THE CONTENTS THAT WE SHOULD USE FOR THE PRESENTATION OF DIGITAL WORLD
Lana71 [14]

Answer:

Introduction

Importance

Advantages

Disadvantages

Effects

Conclusion

8 0
3 years ago
I will mark you Brainliest if you could guess my birthday.
kipiarov [429]

Answer:

3 ?

i think...

3 0
3 years ago
Read 2 more answers
Other questions:
  • Explain briefly why people often have a pretty good understanding of computer hardware.
    14·1 answer
  • What is C.R.A.T systems used for?
    9·1 answer
  • Does the Main Content (MC) of a web page include searchboxes?
    10·1 answer
  • 1. ________ is often defined as using illicit (illegal) drugs, or when the drug is alcohol, tobacco, or a legitimate drug (presc
    13·1 answer
  • Which of the following best describes a situation where software should be upgraded instead of replaced?
    6·1 answer
  • Which is a feature of audio editing software?
    11·2 answers
  • What is the way to discover requirments for software projects ?
    14·1 answer
  • Hurry i need help What would provide structured content that would indicate what the code is describing ?
    12·1 answer
  • Output is the act of is the act of entering the data to the computer?​
    10·1 answer
  • Help me to solve please​
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!