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
a 0.600 kg dynamics trolley has 1.5 kg load added. It is launched with a force of 10.n what is the acceleration
Anastaziya [24]

Answer:

acceleration = 4.76 m/s²

Explanation:

Given that"

the mass of the dynamic trolley = 0.6 kg

the mass of the load  = 1.5 kg

total mass = (0.6 + 1.5) kg = 2.1 kg

the force = 10 N

Thus;

using the formula of force which is;

Force = mass × acceleration

10 = 2.1  × acceleration

acceleration = 10/2.1

acceleration = 4.76 m/s²

7 0
2 years ago
When is the redo log buffer written to the redo log file?
natka813 [3]

Answer: B)The redo log buffer becomes one-third full.

Explanation:Redo log buffer is the type of buffer file that is present for storing the changes that have been done in data. Database changes are the made goes in the records of the redo entries.the change of the buffer to the redo files is done when the buffer contains change records which are full till the one-third section, thus conversion takes place from the redo buffer to the redo files.

5 0
3 years ago
Insert the appropriate functions in the Summary Statistics section of the worksheet: cells H18:H22. Format the payments with Acc
liberstina [14]

Answer:

Explanation:

If we want to insert the appropriate functions, we can know the operation, for example, it could be a sum, multiply, average or only divide, but if we want to apply for a format number like accounting number, we must go to the tab home and the section number, we can change the format number, an accounting or even text format.

8 0
3 years ago
PLEASE HELP! In the evolution of the internet, which event occurred most recently?
Pani-rosa [81]
Just took the quiz and Do is the correct answer.
5 0
3 years ago
Where Can I Get Actual Microsoft AZ-900 Exam Questions?
Pachacha [2.7K]

Answer:

Pls check the site "examtopics"

U fill find ur questions there

8 0
3 years ago
Other questions:
  • What are the two different frequencies WiFi operates on?
    9·2 answers
  • When CPU failed what will happen?
    10·1 answer
  • Write a program in python that ask the user to enter a word and then capitalizes every other letter of that word
    15·1 answer
  • Mobile apps known as news _________ collect articles from a variety of sources and present them to you in a magazine-style forma
    7·2 answers
  • Which option ie an example of an html end tag
    15·1 answer
  • Most operating systems today primarily use a ____.
    12·1 answer
  • Write a Java program that prompts the user for an int n. You can assume that 1 ≤ n ≤ 9. Your program should use embedded for loo
    5·1 answer
  • Artificial intelligence (AI) and machine learning are especially important during which security information and event managemen
    8·1 answer
  • Is each of the following method identifiers (a) legal and conventional, (b) legal but unconventional, or (C) illegal?
    5·1 answer
  • Computer science student jones has been assigned a project on how to set up sniffer. What just he keep in mind as part of the pr
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!