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]
2 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]2 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
3 Points
tino4ka555 [31]

Answer:

its B the person in the comments were right

Explanation:

took an edge test

6 0
3 years ago
Which of the following ""invisible"" marks represents an inserted tab?
Pachacha [2.7K]

Answer:

Easy peasy, if you open Microsoft word and you click up at the top and you click the symbol as shown in A, then you click on inserted tab it will show up as B which is  → symbol

So the answer is B  →.

4 0
3 years ago
Problems and Exercises 16 through 43 are based on the entire ("big" version) Pine Valley Furniture Company database. Note: Depen
lesya [120]

Answer:

SQL queries

The command used to display the customer ID and total number of orders placed is given below

Query:

SELECT CustomerID, COUNT (orderID) AS TotalOrders

FROM Order_Table

GROUP BY CustomerID

Explanation:

SQL queries

The command used to display the customer ID and total number of orders placed is given below

Query:

SELECT CustomerID, COUNT (orderID) AS TotalOrders

FROM Order_Table

GROUP BY CustomerID

SELECT - To query the database and get back the specified fields SQL uses the select statement

CustomerID is a coloumn name

The function COUNT(OrderID) returns the number of orders

Totalorderds is a label

FROM - To query the database and get back the preferred information by specifying the table name

Order_Table is a table name

GROUP BY - The clause is used to group the result of a SELECT statement done on a table where the tuple values are similar for more than one column

The table below displays the CustomerID and total number of orders placed

CustomerID                                              Totalorders

4                                                                    28

1                                                                      6

12                                                                    5

16                                                                    5

6                                                                     3

9                                                                     3

15                                                                    3

3                                                                     1

13                                                                    1

14                                                                    1

The table below shows the total number of orders situated for each sales person

SalesPerson_ID                                         TotalOrders

3                                                                    16

2                                                                     3

4                                                                     3

5                                                                     3

3 0
2 years ago
What do economists call a decline in the real GDP combined with a temporary rise in price level?
ad-work [718]
A <span>stagflation is my answer.</span>
3 0
3 years ago
Read 2 more answers
Write a program to change background colour of your visual basic form with any 3 different events.​
Stels [109]

Answer:

To change the background color, select the form in Visual Studio and locate the BackColor property in the Properties panel. There are a number of ways to specify a color. Color by name - Simply type in a color name into the BackColor value field (for example Red, Yellow, Cyan etc).

Explanation:

4 0
2 years ago
Read 2 more answers
Other questions:
  • The answer for this question?
    14·1 answer
  • If your BAL is .10 you can expect a _______ drop in complex performance compared to the sober level
    6·1 answer
  • The second step when using the problem-solving process is to
    7·1 answer
  • "You are setting up a new subnetwork on an existing network. Management has asked that you use existing cabling that the company
    14·1 answer
  • You turn your computer on and the computer will not boot up. What is something you should do to diagnose the problem?
    6·2 answers
  • 3. When you right-click a linked spreadsheet object, what commands do you choose to activate the Excel features?
    7·2 answers
  • REPORT THIS USER. HE'S SHOWING HIS YK WHAT TO EVERYONE INCLUDING ME. HIS ACCOUNT PROFILE IS IN THE PICTURE BELOW
    14·1 answer
  • What tool can you use to discover vulnerabilities or dangerous misconfigurations on your systems and network
    5·1 answer
  • I have a very quick question. So im applying for Early college and i need some future educational goals and maybe im just thinki
    6·1 answer
  • Answer This One Question Right For Brainliest
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!