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]
3 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]3 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]3 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
True/False
ANEK [815]

Answer:

The following statement is True.

Explanation:

In the given statement, with the help of the point mode, the user can easily and fastly enter the formulas which is more correct and accurate as compared to the formulas enter by using the buttons of the keyboard. In other words, the user can easily and correctly enters the formulas by using the Point method. So, that's why the following statement is correct.

4 0
3 years ago
Black and white squares codehs, i need the whole code (40 points for correct answer)
ludmilkaskok [199]

Answer:

speed(0)

penup()

setposition(-100,0)

count=0

def make_squares(i):

if i % 2 == 0:

begin_fill()

for i in range(4):

forward(25);

left(90)

end_fill()

penup()

pendown()

for i in range(6):

pendown()

make_squares(i)

penup()

forward(35)

Explanation:

3 0
2 years ago
Read 2 more answers
What is one way you might code-switch when posting a comment to a class discussion?
irina [24]

Answer:

The term code switching has been expanded and can encapsulate in any situation that speaker find to be switch from vocabulary.

Explanation:

It is a truly remarkable skill when you communicate your emotions, thoughts and opinion to others. It does not mean that we just to communicate our language but our language influence our thought, emotions and language and self identity.

we communicate our culture that is reflected in our language. Our language tells that who we are and from where we comes.

Code switching is related to the speakers alternates use of multiple language. in the one communication.

For example: Grace for beautiful gift ( Esta awesome).

7 0
2 years ago
ANWSER ASAP
Alona [7]

Answer:

Cell wall more selectively controls what goes in and out of the cell, it gives a plant cell its shape, is rigid.

6 0
2 years ago
Consider a system consisting of m resources of the same type, being shared by n processes. Resources can be requested and releas
Mama L [17]

Answer:

Explanation:

The system will be deadlock free if the below two conditions holds :

Proof below:

Suppose N = Summation of all Need(i), A = Addition of all Allocation(i), M = Addition of all Max(i). Use contradiction to prove.

Suppose this system isn't deadlock free. If a deadlock state exists, then A = m due to the fact that there's only one kind of resource and resources can be requested and released only one at a time.

Condition B, N + A equals M < m + n. Equals N + m < m + n. And we get N < n. It means that at least one process i that Need(i) = 0.

Condition A, Pi can let out at least 1 resource. So there will be n-1 processes sharing m resources now, Condition a and b still hold. In respect to the argument, No process will wait forever or permanently, so there's no deadlock.

5 0
3 years ago
Other questions:
  • Devices such as monitors and printers that are connected to a computer are called ________.
    12·1 answer
  • Write a program that calculates the cost of a phone call. The user enters a positive integer that
    11·1 answer
  • . char values are surrounded by _____ quotes
    15·1 answer
  • Hilary works at Klothes Kloset. She quickly helps the customers, and her cash drawer is always correct at the end of her shift.
    9·1 answer
  • Which of these statements makes the most sense? a folder is contained within a file. a file is contained within a folder. a driv
    9·2 answers
  • Are storage devices input devices
    8·1 answer
  • Write any four common hardware devices​
    6·1 answer
  • Complete the function to return the result of the conversiondef convert_distance(miles):km = miles * 1.6 # approximately 1.6 km
    13·1 answer
  • The main function of a(n) ____________________ is to centralize access control for the network by keeping an eye on both inbound
    9·1 answer
  • You want to be super private with your email. You'd like to be able to download your email to a single device, then remove it fr
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!