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

Complete the function void update (int *a, int *b), which reads two integers as argument, and sets a with the sum of them, and b

with the absolute difference of them. (7 points)
Computers and Technology
1 answer:
IRINA_888 [86]3 years ago
7 0

Answer:

#include <iostream>

#include <stdio.h>

using namespace std;

// create function called abDifference

void update(int *a,int *b) {

      int r = *a;

#include <iostream>

#include <stdio.h>

using namespace std;

// create function called abDifference

void update(int *a,int *b) {

   int r = *a;

   *a = *a+*b;

   *b = r-*b;

   if(*b < 0)*b *= -1;

}

int main() {

   int num1, num2;

   cout<<"enter two ints"<<endl;

   int *pa = &num1, *pb = &num2;

   scanf("%d %d", &num1, &num2);

   update(pa, pb);

   cout<<num1<<endl;

   cout<<num2<<endl;

   return 0;

}

Explanation:

The function update does two things:

  1. 1. It evaluates the sum of the two arguments passed to it
  2. 2. It evaluates the absolute difference of the two ints passed as an argument

In the main method, the user is prompted to enter two ints. The method update() is called and passed the two ints. It prints the sum as num1 and the abs difference as num2

You might be interested in
What is database design?
finlep [7]

Answer: Database design is the model created of data/information for any particular organization .the relation between the information and which data is to be stored is the most important factor for designing .These parameters are decided by the designer of the database.

After the decision of the designed the data is invoked in the database .The data representation in the theoretical manner is known as ontology.The classification and relation defining is the purpose of the database design.

3 0
3 years ago
Write a Python function to determine the volume of material remaining after the hole is drilled. The function should take as inp
Andru [333]

Answer:

height = int(input ("Enter height : ") )

print (height)

width = int( input("Enter length : ") )

print (width)

half_width =width/2

half_height=height/2

while 0==0:

   radius = float( input("Enter radius : ") )

   print (radius)

   

   if radius<half_width and radius <half_height:

       break

def remainingVolume(height,width,radius):

       

   vol_box=height*width*width

   print (vol_box)

   vol_hole=3.14178*radius*radius*height

   print (vol_hole)

   

   remaining_vol=vol_box-vol_hole

   print ("Remaining volume is ",remaining_vol)

   

remainingVolume(height,width,radius);

Explanation:

Take input from user for height ,width and radius. To find volume of box formula is vol=height* width*length\\

Let's assume width and length is same so

length= width

Using this formula of box volume find box volume.Now find volume of hole.

Consider hole as small cylinder, find volume of cylinder and subtract from volume of box to get remaining volume of box after hole.

vol_of_cyl=\pi radius^{2} height

5 0
2 years ago
How is hyper tension, heart disease, and strokes related?
amid [387]
Hypertension, heart disease, and stroke are related by the process of atherosclerosis. Atherosclerosis refers to the build-up and accumulation of fatty substances (also known as plaque) in the inner walls of the arteries. Atherosclerosis can lead to hypertension, heart disease, and strokes.
5 0
3 years ago
PHP can be run on Microsoft Windows IIS(Internet Information Server):
Natali [406]

Answer:

True

Explanation:

PHP is supported on number of Web Server platforms. These include Apache 1.x, Apache 2.x, lighttpd and IIS.

IIS is supported on Windows platform for both x86 and x64 configuration.

The IIS or Internet Information Services is a web server developed by Microsoft for Windows platform. The initial release of IIS 1.0 was way back in 1995. The current available version of IIS is 10.x.

3 0
3 years ago
If you cause a car accident, which type of insurance will require you to pay the least out of pocket?
Svetlanka [38]
Low deductible plan is correct
4 0
3 years ago
Read 2 more answers
Other questions:
  • Principles of defensive driving include:
    15·1 answer
  • What is cpu????????????????????????????
    12·2 answers
  • A ____ is a text document written in HTML.
    13·1 answer
  • After compiling source code, which command still needs to be run in order to copy the newly compiled binaries into a directory l
    5·1 answer
  • Which of the following describes the phishing method of information security crime?
    14·2 answers
  • Instructions The population of town A is less than the population of town B. However, the population of town A is growing faster
    8·1 answer
  • Inputting a range of numbers comprising a batch and then inputting each serially numbered document is characteristic of the cont
    11·1 answer
  • Sharing resources.
    14·1 answer
  • Select the correct technical term for each definition by using the drop-down menus.
    13·1 answer
  • write a program which prompts the user for a celsius temperature, convert the temperature to fahrenheit, and print out the conve
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!