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
blondinia [14]
3 years ago
14

Define a void function that calculates the sum (+), difference (-), product (*), quotient (/), and modulus (%) of two integer nu

mbers that would be passed through parameter list. The function returns the results back to the caller (main) through reference parameters. Define another function that simply displays the result.
Computers and Technology
1 answer:
BabaBlast [244]3 years ago
7 0

Answer:

#include <iostream>

using namespace std;

void multipurpose(int &num1,int &num2,int &add,int &subt,int &multi,int &divi,int &modulo )

{

   add=num1+num2;//adding two numbers...

   subt=abs(num1-num2);//subtracting two numbers...

   multi=num1*num2;//multiplying two numbers...

   divi=num1/num2;//Finding quotient of two numbers...

   modulo=num1%num2;//Finding modulo of two numbers...

}

void print(int add,int sub,int divi,int multi,int modulo) //function to print the values.

{

   cout<<"The addition is "<<add<<endl<<"The subtraction is "<<sub<<endl

   <<"The quotient is "<<divi<<endl<<"The multiplication is "<<multi<<endl

   <<"The modulus is "<<modulo<<endl;

}

int main() {

   int a,b,sum=0,mult=0,divi=0,sub=0,modulo=0;

   cin>>a>>b;

   multipurpose(a,b,sum,sub,mult,divi,modulo);

   print(sum,sub,divi,mult,modulo);

return 0;

}

Enter the numbers

12 12

The addition is 24

The subtraction is 0

The quotient is 1

The multiplication is 144

The modulus is 0

Explanation:

I have created a function multipurpose that has a argument list of two numbers ,and variables for addition,subtraction,multiplication,Division,Modulus and these all are passed by reference.Since the function is of type void so it cannot return anything so the only way to store the result is by passing the variables to store the results by  reference.

The other function print has the arguments of all the results here you can pass them by value or by reference because you only need to print the results.

You might be interested in
Which of the following would you use to search a table in Excel?
snow_tiger [21]

Answer:

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are empty</em>

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are emptya COUNT</em>

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are emptya COUNTb. COUNTA</em>

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are emptya COUNTb. COUNTAc. COUNTBLANK</em>

<em>Which function would you use if you wanted to count the number of values, but ignore the cells that have text or are emptya COUNTb. COUNTAc. COUNTBLANKd. COUNTVALUES</em>

3 0
3 years ago
Read 2 more answers
What is the fifth and final stage in the process of media production?
Monica [59]

Answer:54

Explanation:

8 0
3 years ago
Nathan wants to create multiple worksheet containing common formatting styles for his team members. Which file extension helps h
Luden [163]
Templates help Nathan to create multiple worksheets with common styles. He needs to save them with the xls extension.
5 0
3 years ago
Read 2 more answers
Write a python program to find factorial, use exception handling and display an appropriate message if the user inputs alphabets
MrRissso [65]

def func(lst):

   fac_lst = ([])

   try:

       for x in lst:

           i = 0

           fac = 1

           while i < x:

               fac *= (x - i)

               i += 1

           fac_lst.append(fac)

       return fac_lst

   except TypeError:

       return "Please input only numbers!"

   except IndexError:

       return "Please stay within the index!"

lst = ([1, 2, 3, 4, 5, 6, 7, 8])

print(func(lst))

I think this is what you're looking for. Best of luck.

6 0
3 years ago
PLEASE HELP I WILL GIVE BRAINLIEST AND 100 POINTS IF U ANSWER COMPLETELY WITHIN 30 MIN
icang [17]

Answer:

Explanation:

be themselves and that is more than enough to be beautiful. Lastly, I would organize the colorson each photo to be organized to make it look like flowers. That would add a nice touch to seemlike the unorganized pictures are actually organized.

7 0
2 years ago
Other questions:
  • Pls help brainliest
    12·1 answer
  • The network layer of the Internet model uses the _____________ protocol to route messages though the network.
    13·1 answer
  • 802.11ac provides an advantage over 802.11n by incorporating increased channel bonding capabilities. What size bonded channels d
    10·1 answer
  • Select the correct answer Steven has been assigned a task to lead a team to analyze volumes of financial data Steven observes th
    8·1 answer
  • To access your gradebook you click on the __________.
    6·2 answers
  • Give 4 examples of mnemonic codes, and what do they do?
    15·1 answer
  • OH NO THE HEAVY IS DEAD
    12·2 answers
  • Whose work is responsible for the invention of the air bag? Scientist, Engineers or both?
    12·1 answer
  • The factors of power of device
    10·1 answer
  • Is TCP really more secure than other L4 protocols by default?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!