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
tester [92]
3 years ago
8

Write the definition of a function divide that takes four arguments and returns no value . The first two arguments are of type i

nt . The last two arguments arguments are pointers to int and are set by the function to the quotient and remainder of dividing the first argument by the second argument . The function does not return a value .The function can be used as follows:int numerator=42, denominator=5, quotient, remainder; divide(numerator,denominator,&quotient,&remainder); / quotient is now 8 / / remainder is now 2 /
Computers and Technology
1 answer:
Nastasia [14]3 years ago
8 0

Answer:

#include <iostream>

using namespace std;

void divide(int numerator, int denominator, int *quotient, int *remainder)

{

*quotient = (int)(numerator / denominator);

*remainder = numerator % denominator;

}

int main()

{

int num = 42, den = 5, quotient=0, remainder=0;

divide(num, den, &quotient, &remainder);

 

return 0;

}

Explanation:

The exercise is for "Call by pointers". This technique is particularly useful when a variable needs to be changed by a function. In our case, the quotient and the remainder. The '&' is passing by address. Since the function is calling a pointer. We need to pass an address. This way, the function will alter the value at the address.

To sum up, in case we hadn't used pointers here, the quotient and remainder that we set to '0' would have remained zero because the function would've made copies of them, altered the copies and then DELETED the copies. When we pass by pointer, the computer goes inside the memory and changes it at the address. No new copies are made. And the value of the variable is updated.

Thanks! :)

You might be interested in
Ginny faced an application error while executing the recorder in opera. Which web browser is generally recommended to use with r
Kazeer [188]

Internet Explorer 9+ is the web browser recommended to use with recorders.

<h3>What is a website?</h3>

A website is a collection of web pages and related material that is published on at least one server and given a shared domain name.

As we know,

Recorders are perfect for desktop applications because they can record a variety of items, including mouse clicks, scrolling, radio buttons, list boxes, checkboxes, and drop-down menus.

Thus, Internet Explorer 9+ is the web browser recommended to use with recorders if Ginny faced an application error while executing the recorder in opera.

Learn more about the website here:

brainly.com/question/19459381

#SPJ4

6 0
2 years ago
1. Write a program to input four numbers and store them in variables.
slega [8]
Honestly , brainly may seem like a place to get answers but it’s not , people come here to troll, like me
7 0
3 years ago
PLEASE HELP QUICK WILL GIVE BRAINLY
kipiarov [429]

Answer: Where the guide lines?

Explanation: I’ll help but where the guidelines?

7 0
3 years ago
Write a program to find all integer solutions to the equation 4x + 3y -9z = 5 for values of x, y, and z between 0 to 100.
rjkz [21]

Answer:

Following are the code to the given question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

  int c= 0;//defining integer variable to count number of solutions

  int x,y,z;//defining integer variable which is used in the loop

  for (x = 0; x <= 100; x++)//defining for loop to x value

     for (y = 0; y <= 100; y++)//defining for loop to y value

        for (z = 0; z <= 100; z++)//defining for loop to z value

           if (4 * x + 3 * y - 9 * z == 5)//use if to check given condition

           {

              c++;//increment count value

              cout << "(" << x << "," << y << "," << z << ")";//print solutions  

              cout << (c % 11? " " : "\n");//use for add file solution in a row

           }

  cout << "\n\nThere are " << c << " solution(s)\n";//print solution couts

  return 0;

}

Output:

Please find the attached file.

Explanation:

In the above-given code four integer variable "x,y,z, and c" is declared, in which "x,y, and z" is used in the for loop with the if conditional statement that checks the given condition and prints the solution and the "c" variable is used to counts the number of solution, and at the last, it uses the print method to print its values.  

8 0
3 years ago
When constructing policies regarding data _______________, it is important that these policies offer particular guidance on sepa
Rama09 [41]

Answer:

access

Explanation:

Managing users' access rights to digital resources within the organization's environment is a fundamental SoD control. As more services are requested by users, utilizing the built-in panels to check compliance with internal controls might become excessive. Companies require a comprehensive Identity Governance and Administration plan to monitor these user access and offer an authoritative source of identity definitions in order to ensure  SoD compliance.

6 0
2 years ago
Other questions:
  • What are the desirable qualities of a Product Vision?
    11·1 answer
  • Word's Help feature is useful if you need to quickly learn how to print a document
    14·1 answer
  • What does cmyk stand for?
    5·2 answers
  • Given that add, a function that expects two integer parameters and returns their sum, and given that two variables, euro_sales a
    7·1 answer
  • Write a SELECT statement that returns three columns: VendorName from Vendors table, DefaultAccount No from Vendors table, Accoun
    10·2 answers
  • Juan has performed a search on his inbox and would like to ensure the results only include those items with attachments which co
    14·2 answers
  • What is a cloud in the world of computing
    7·1 answer
  • HELP ME?!!?!?!?!?!?
    9·2 answers
  • Which similar computer network components connect multiple devices?
    7·1 answer
  • The sequence of Figures shows a pattern. if the pattern repeats, how many triangles will the figure 5 have ?​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!