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
Two electronics technicians are discussing electrical quantities. Technician A says that resistance is an opposition to electric
inessss [21]
Neither are correct.

Resistance is opposition to CURRENT not power.
Technition B Is wrong about the voltage thingy.
6 0
3 years ago
Will robots take people's jobs? <br> write in complete sentence.
lilavasa [31]

Answer:

yes

Explanation:

yes because they already have them for old gun ships (which they still use) and they have made cars with them and more including bombing situations IED detinators they used in Afghanistan and in Iraq in 2011.

6 0
3 years ago
Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedCl
vlada-n [284]

Answer:

You need to make sure that the unsupportedclassversionerror is a sub class of the linkage bug. Its a class format error. And this error is given by JVM as it tries to study the class file who minor and major version numbers are outdated. This error has been arising since Java 1.2 and is being thrown during the run time as well as most precisely during the linking phase.

It indicates that the current JVM is not supporting the class file of the application,

Hence,we must verify the installed version of java.

Explanation:

You need to make sure that the unsupportedclassversionerror is a sub class of the linkage bug. Its a class format error. And this error is given by JVM as it tries to study the class file who minor and major version numbers are outdated. This error has been arising since Java 1.2 and is being thrown during the runtime as well as most precisely during the linking phase.

It indicates that the current JVM is not supporting the class file of the application,

Hence,we must verify the installed version of java.

And we need to install the Java latest version.

We can find the Java version by  

Java -version

The following class can help in finding the version number of the class file.

FindMajorVersion.java:

import java.io.FileInputStream;

import java.io.InputStream;

import java.io.File;

import java.io.IOException;

import java.io.DataInputStream;

public class FindMajorVersion {

 

    public static void main(String[] args) throws IOException {

         // Verify at least one argument is being passed to the application class.

         if(args.length < 1)

              throw new RuntimeException("Usage: FindMajorVersion <path_to_class_file>");

 

         // Make a buffer for storing the first 8 bytes of a file.

         byte[] buffer1 = new byte[8];

 

         // Create an InputStream  

         InputStream is1 = new DataInputStream(new FileInputStream(new File(args[0])));

 

         // Read the first 8 bytes of the file.

         is.read(buffer);

 

         // Print out the major version number.

         System.out.println(buffer1[7] + " (" + String.format("0x%x", buffer1[7]) + ")");

 

         // Shut down the stream.

         is.close();

    }

}

You can thus find the appropriate version, and upgrade the java which is installed to the latest version. And thus, you can make it certain that all the Java apps are successfully executed inside the system.  

3 0
3 years ago
You areYou are a member of the application development organization for a small but rapidly growing software company that produc
bija089 [108]

Answer:

Following are the solution to this question:

Explanation:

Please find the complete question in the attached file.

It will obtain as much information about this matter as necessary even before the conference. It includes its gravity or probability of risk, various cases in the entire event, the possible solutions to the issues, as well as the consequences for parties involved in each potential answer, and Only at conferences, it may clarify to my boss that the explanation for the problem and also in details. It will be doing everything possible and try not to conceal the details but highlight the problem.

3 0
3 years ago
Question #1
Evgen [1.6K]

Answer:

Pseudocode and flowchart.

Explanation:

I just got it correct.

8 0
3 years ago
Other questions:
  • When the degree of color contrast between items is low, the content is easier to see and read. True or False
    12·1 answer
  • What is responsible for what u see on a computer monitor?
    11·1 answer
  • Encryption Using Rotate Operations Write a procedure that performs simple encryption by rotating each plaintext byte a varying n
    10·1 answer
  • A Unit of information containing the objects position, rotation, and scale values is called:
    13·1 answer
  • ____________ hackers break into systems legally for non-malicious reasons such as to test system security vulnerabilities
    7·2 answers
  • Which of the following is not a type of bank? (Everfi)
    9·2 answers
  • 5.8.1: Modify an array parameter. Write a function SwapArrayEnds() that swaps the first and last elements of the function's arra
    14·1 answer
  • The network team has well established procedures to follow for creating new rules on the firewall. This includes having approval
    15·1 answer
  • Write at least and explain four types of escape sequences and create an example in an IDE which consist of the mentioned escape
    7·1 answer
  • Can someone write me a design brief about a stadium​
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!