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
Mamont248 [21]
3 years ago
6

A function test() that would take three integervalues x, y and z (as

Computers and Technology
1 answer:
marta [7]3 years ago
4 0

Answer: The c++ program to implement test() method is given below.

#include <iostream>

using namespace std;

int test(int a, int b, int c);

int main() {

   int x, y, z;

   cout<<"This program displays the largest number."<<endl;

       cout<<"Enter first number"<<endl;

       cin>>x;

       cout<<"Enter second number"<<endl;

       cin>>y;

       cout<<"Enter third number"<<endl;

       cin>>z;

   int max = test(x, y, z);

   cout<<"The largest number is "<<max<<endl;

   return 0;

}

int test(int a, int b, int c)

{

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

       return a;

 

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

           return b;

           

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

           return c;

     

}

OUTPUT

This program displays the largest number.

Enter first number

12

Enter second number

0

Enter third number

-87

The largest number is 12

Explanation:

The method test() is declared as follows.

<em>int test(int a, int b, int c);</em>

The method is declared with return type int since it returns an integer, i.e., the largest of the three parameters.

This program is designed to accept 0 and all values of integers. Hence, input is not tested for validity. It is assumed that the user enters only numerical values.

The program declares and uses three integer variables to store the user input.

<em>int x, y, z;</em>

The method test() is designed to accept three integer parameters. This method is called once the user enters three numbers for comparison.

<em>int test(x, y, z);</em>

These numbers are compared in order to return the largest number.

No variable is used for comparison. The method simply compares the numbers using multiple if-else statements.

<em>if((a>b)&&(a>c))</em>

<em>        return a;</em>

The same comparison logic is applied for other two input values.

The largest number is returned to the calling function which is main() in this program. This value is stored in the integer variable, max, declared in the main() method. The variable max is declared and initialized simultaneously.

<em>int max = test(x, y, z);</em>

This value is then displayed on the screen.

<em>cout<<"The largest number is "<<max<<endl;</em>

You might be interested in
In order to achieve a win-win solution, all parties involved should negotiate a solution. True or False ?
ryzh [129]
True you cant win if you dont know what you got right

6 0
3 years ago
Read 2 more answers
ASAP HELP NO GUESS A new pet store wants to design a logo to be displayed on business cards, posters in the shop’s windows, and
murzikaleks [220]

[2] JPG graphic  i hope this helps

6 0
3 years ago
Read 2 more answers
A smart refrigerator can use what to detect when you are running low on milk, and then send a reminder to you on a wireless.
Olegator [25]

Answer:

RFID scanning or Barcode reader

Explanation

Smart refrigerators have inbuilt RFID scanning technology that help monitor the stock that is inside your fridge. Once you pass your items through the inbuilt RFID scanner in the fridge, the barcode of your items is cross-referenced with a database and given a unique tag for identification. This technology helps detect and track the stock that is inside your fridge and when you start running low, the RFID can be triggered to send a reminder as a notification on your email or a text message.

3 0
3 years ago
Give 15 examples of copyright and trademarks that we come in contact with everyday. (Doesn't hve to be 15 could be 3 or 5) PLEAS
oksano4ka [1.4K]
Roads, trading, Government, water systems,
6 0
3 years ago
Assume a program requires the execution of 50 x 106 (50e6) FP instructions, 110 x 106 (110e6) INT instructions, 80 x 106 (80e6)
tresset_1 [31]

Answer:I really don’t know

Explanation:

Um You can look it up though

7 0
3 years ago
Other questions:
  • 3. Which of the following phase types will make a sound louder? In-phase, inverted phase, or partial phase angle waves?
    7·2 answers
  • Clep allows students to do all of thw following except which?
    11·2 answers
  • Which of the following is the MOST sensitive Personally Identifiable Information (PII) and should be shared cautiously and only
    8·1 answer
  • Which of the following is the definition of registration authority ( RA)?
    10·1 answer
  • Each of the outcomes listed below is a result of executing the following script except for one. Which one? CREATE ROLE ExampleRo
    6·1 answer
  • Write a function findWithinThreshold that identifies the elements of a given array that are inside a threshold value. Takes the
    13·1 answer
  • What output is generated by this for loop?
    6·1 answer
  • Is there any difference beetween the old version of spyro released on the origional and the newer ones??? or is it only change i
    8·1 answer
  • A new president has been elected. She promises to lower taxes drastically. What is most LIKELY to happen as a result of this dec
    8·1 answer
  • What is Parallelism? And what is Pipelining?<br> Can someone please explain them fully?!
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!