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
Write an if else statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. O
brilliants [131]

Answer:

if(a < 10)

{ b = 0; c = 1;}

else

{ b = -99; c = 0;}

Explanation:

4 0
3 years ago
Ncomputing and thin client<br>what it is <br>why is done , how it works and how it's <br> done ​
SVEN [57.7K]

The term NComputing  is known to be a form of desktop virtualization company that is said to creates hardware and software to form virtual desktops.

The term Thin clients is known to be virtual desktops. They help a lot of users at the same time to share a single operating system instance.

<h3>What is the aim of a thin client?</h3>

In Ncomputer networking, a thin client is known to be a kind of low-performance computer that is known to be optimized and used for setting up a remote connection.

It is often used with a server-based computing system. The server here is one that often does most of the work, such as launching software programs, etc.

Learn more about Ncomputing from

brainly.com/question/12629145

4 0
2 years ago
Hotels and motels that are part of a ________ share a centralized reservation system and a common image, logo or advertising slo
hoa [83]
It is company , I think .
8 0
3 years ago
Melissa needs to put a topic name on her email that she will send will to her teacher . choose the name of the field
Lera25 [3.4K]

It is A. I am pretty sure

8 0
3 years ago
Read 2 more answers
HELLO answer this. Sidney needs to create a decimal number variable that will be added to another number. What kind of variable
kipiarov [429]

Answer:

Option D. float is the correct answer.

Explanation:

Decimal number contains decimal point. Out of all the given data types, float data type store the number with decimal point.

As the number has to be further used for calculations float ahs to be used. Because the numbers can also be stored in string but cannot be used for further calculations.

Hence,

Option D. float is the correct answer.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Someone help me I don’t know what to do /COMPUTER SCIENCE
    5·1 answer
  • 17) you need to locate an article that (1) is published by a university or proffessional association(2) is authored by clearly d
    6·1 answer
  • Although the Earth's crust formed relatively early in the Earth's history, it was not present when the Earth first began to form
    12·2 answers
  • If you were setting up a network with 100 nodes and you wanted no more than 25 nodes per segment: what devices and connections w
    9·1 answer
  • Give sally sue specific suggestions on how she can improve her powerpoint skills.
    6·1 answer
  • Which DHCPv4 message will a client send to accept an IPv4 address that is offered by a DHCP server? (Points : 5) Unicast DHCPACK
    8·1 answer
  • It is necessary tto save updates often when working in google docs? True or false
    11·2 answers
  • PLEASE HELP THANK YOU
    7·1 answer
  • Why is it easier to spot a syntax error than a logical error?​
    10·2 answers
  • What is the two’s compliment of -95,-122,-111,-57
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!