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
To what would you compare the transport layer?
GarryVolchara [31]
The above question has multiple choices as below

<span>A. Data links
B. The post office
C. Driving a car
D. A train

The answer is (B) The Post Office.

In layman’s terms, transport layer is similar to the post office functions of delivering parcels and letters at the agreed delivery deadlines. It also notices any dropped info and re-transmits it.
Just like the post office, the transport layer directs messages and information between specific end users. If by mistake you write a letter to the wrong person, the letter will be returned and the postal employee will stamp it as address unknown.

</span>
4 0
2 years ago
A web designer is creating a web site and wants each browser to resize the text size to look the same in each device. what measu
adelina 88 [10]
The designer could use the measurements in pixels. 
4 0
3 years ago
You are troubleshooting an issue where a PC can reach some hosts on the Internet (using either DNS name or IP address), while se
wolverine [178]

The options are missing from the question,below are the options to choose from;

A) incorrect (or missing) routes in a routers routing table

B) incorrect DNS configuration on the PC

C) incorrect default gateway configuration on the PC

D) duplicate IP addresses on your LAN

Answer: The correct answer to the question is option A

INCORRECT (OR MISSING) ROUTES IN A ROUTERS ROUTING TABLE.

Explanation: When it is possible for a PC to ping some devices but not actually all,we can then make an assumption that either it has a wrong subnet that is configured or the router from the path to the remote device actually has an incorrect or a missing routes to the device.

5 0
3 years ago
29
denis23 [38]

The correct answer is A it transfers control to the next loop in the program.


The most valid answer is that the break statement Exits the loop and continues executing the program, but assuming that there are other loops, the control of the program will go to them since the first loop is broken out of.


3 0
3 years ago
V to "mutual funds"?
Anettt [7]

Answer:

D. All of the above.

Explanation:

The mutual funds can be affected by the market condition, and the investor's investment can be lost. It does not provide any assurance or any guarantee that the scheme targets or the goals are going to be achieved or will not be achieved. The investment of the fund is done later, and businesses are picked up according to the wishes of the investor who creates the pool.

And they can be a smart investment for young people, and they do contain the combination of various types of stocks. And they are commonly found in the retirement accounts. Hence, all of the above points are true about mutual funds.

3 0
3 years ago
Other questions:
  • Which key on a laptop keyboard is often used to help pair a mobile device with another device for communication purposes?
    12·1 answer
  • To add and remove chart elements, you can use the add chart element button in the charts layout group on the ____ tab.
    6·1 answer
  • Universal Containers are using Salesforce for Order Management and has integrated with an in-house ERP system for order fulfilme
    5·1 answer
  • What type of file can most software applications read?
    5·2 answers
  • What keyword do we use when instantiating an object _________________
    15·1 answer
  • Importance of availability of mobile devices content that is of interest for users.
    12·1 answer
  • A computer processes data using only 1s and 0s true or false?
    9·2 answers
  • Quinton is having trouble learning Spanish because he keeps reverting back to the grammatical structures of his native English l
    6·1 answer
  • When entering a expressway using a weave lane you must do what
    7·1 answer
  • Which question about whale sharks is nonscientific?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!