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
Design a for loop that gets 6 integer numbers from a user, accumulates the total of them, then displays the accumulated total to
PSYCHO15rus [73]

Answer:

Explanation:

The following loop code is written in Java and asks the user for the 6 integer numbers as mentioned in the question and sums them up. Finally putting them into a variable named total and printing it out.

       int total = 0;

       for (int x = 0; x < 6; x++) {

           Scanner in = new Scanner(System.in);

           System.out.println("Enter an integer: ");

           total += in.nextInt();

       }

       System.out.println("Your total is: " + total);

6 0
3 years ago
01:24:3
bogdanovich [222]

Answer:

1. Uncompressed audio formats

2. Formats with lossless compression

3. Formats with lossy compression

Explanation:

1. Uncompressed audio formats, such as WAV, AIFF, AU or raw header-less PCM;

2. Formats with lossless compression, such as FLAC, Monkey's Audio (filename extension .ape), WavPack (filename extension .wv), TTA, ATRAC Advanced Lossless, ALAC (filename extension .m4a), MPEG-4 SLS, MPEG-4 ALS, MPEG-4 DST, Windows Media Audio Lossless (WMA Lossless), and Shorten (SHN).

3. Formats with lossy compression, such as Opus, MP3, Vorbis, Musepack, AAC, ATRAC and Windows Media Audio Lossy (WMA lossy).

8 0
3 years ago
The main differences between laptops and desktop computers other than size and portability.
e-lub [12.9K]

Answer:

Difference between laptops and desktop computer are:

  • Desktop computers contain wide variety of components, but laptops are realtively expensive than desktop computers because laptop has high speed and better graphics designs which increased the cost of whole system.
  • Desktop computer processors are larger in size and it is more efficient and powerful as compared to laptops because laptop processor still has some limitations.
  • Laptop uses less power as compared to desktop computer because laptop contain small components and that is why it needs less power.
  • Desktop computers are easy to upgrade and in laptops hard drive and memory, these two components needs to be upgraded.

5 0
3 years ago
Identify when programmers use an Else statement.
Gnesinka [82]

Answer:

to tell the program to take a different action when the If statement answer is false

Explanation:

if x = 0:

     print('x equals 0')

else:

      print('x equals something else that isnt 0')

4 0
3 years ago
Read 2 more answers
What characteristics need to be exhibited by an organisation to improve its software process?
aalyn [17]

Answer:  Defined , Controllable ,  Measured , Effective ,  Institutionalized are some of the characteristics needed to be exhibited by an organisation to improve its software process

Explanation:

Software process improvement(SPI)  helps in achieving goals of software products for an organization. Some of its characteristics are Defined , Controllable ,  Measured , Effective ,  Institutionalized.

It goals must be defined, and must also be controlled and it performance must be measured at regular intervals and any reforms carried out to achieve goals must be effective. Lastly it should implement all goals in an institutional framework to be followed by every one in the organization.

6 0
3 years ago
Other questions:
  • Susan bought a new sweater on sale for $28.93.she was charged HST of 13%.find the total amount of her bill including taxes.​
    9·1 answer
  • What does subscribing to a website’s RSS feed provide to a subscriber?
    10·1 answer
  • A _____________ is a method of controlled entry into a facility and provides access to secure areas such as a research lab or da
    10·1 answer
  • What is the basic difference between a printer and a plotter?​
    12·1 answer
  • Which statement best describes what happen to the temoporary working memory (RAM) of a computer when it shut down
    12·2 answers
  • What is the unit used to describe the intensity of sound?
    5·1 answer
  • What does remedy mean
    7·2 answers
  • The sun emits invisible _____&gt; A) electromagnetic waves B) Waves C) Radiation D) Wavelength E) Ultraviolet Light
    8·1 answer
  • AJ created a list, and he needs all of the numbers to be in order. Which Python function will allow him to organize his list num
    5·2 answers
  • What can be used to help diagnose and fix network connection problems?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!