subject
Computers and Technology, 23.04.2020 15:45 ryan1kk

Write the definition of a function minMax that has five parameters. The first three parameters are integers. The last two are set by the function to the largest and smallest of the values of the first three parameters. The function does not return a value.

The function can be used as follows:

int a=31, b=5, c=19, big, small;

minMax(a, b,c,&big,&small);

/* big is now 31 */

/* small is now 5 */

And this is what I have:

void minMax(int x, int y, int z, int* big, int* small) {

if ((a > b) && (a > c)) {

a = big;

}

else if ((b > a) && (b > c)) {

b = big;

}

else if ((c > a) && (c > b)) {

c = big;

}

if ((a < b) && (a < c)) {

a = small;

}

else if ((b < a) && (b < c)) {

b = small;

}

else if ((c < a) && (c < b)) {

c = small;

}

}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
Ap practice - performance task response the ap create performance task asks you to write about an abstraction that you developed and wrote into your code. most of the time that means identifying a function or procedure you wrote to "manage complexity" in your program. here is the actual prompt from the create performance task: 2d. capture and paste a program code segment that contains an abstraction you developed individually on your own (marked with a rectangle). this abstraction must integrate mathematical and logical concepts. explain how your abstraction manage the complexity of your program. (must not exceed 200 words) below is a segment of code from an "under the sea" program with a rectangle drawn around a portion of the code identifying an abstraction. imagine that you wrote this and are composing an ap response about how this abstraction manages complexity. (note: ignore the requirement that the abstraction integrate "mathematical and logical concepts" for this practice response. just write about managing complexity). explain how the abstraction marked with the rectangle in the code above manage complexity of this program. write your response here submit
Answers: 2
question
Computers and Technology, 22.06.2019 16:10
When copying and pasting text, the first step is move your cursor type the text select the copy command select the paste command
Answers: 2
question
Computers and Technology, 22.06.2019 16:10
Drag each label to the correct location on the imagelist the do’s and don’ts of safeguarding your password.keep yourself loggedin when you leave your computer.don’t write your password down and leave it whereothers can find it.share your password with your friends.each time you visit a website,retain the cookies on your computer.use a long password with mixed characters.
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
File account.java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a string representation. note that the constructor for this class creates a random account number. save this class to your directory and study it to see how it works. then write the following additional code: 1. suppose the bank wants to keep track of how many accounts exist. a. declare a private static integer variable numaccounts to hold this value. like all instance and static variables, it will be initialized (to 0, since it’s an int) automatically. b. add code to the constructor to increment this variable every time an account is created. c. add a static method getnumaccounts that returns the total number of accounts. think about why this method should be static - its information is not related to any particular account. d. file testaccounts1.java contains a simple program that creates the specified number of bank accounts then uses the getnumaccounts method to find how many accounts were created. save it to your directory, then use it to test your modified account class.
Answers: 3
You know the right answer?
Write the definition of a function minMax that has five parameters. The first three parameters are i...
Questions
question
Mathematics, 04.10.2021 01:50
question
Business, 04.10.2021 01:50
question
Mathematics, 04.10.2021 01:50
question
Mathematics, 04.10.2021 01:50
question
English, 04.10.2021 01:50
question
Chemistry, 04.10.2021 01:50
question
Geography, 04.10.2021 01:50
Questions on the website: 13722367