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
Gmod how to make someone admin on a lan server
andrezito [222]
In case you're playing on a local multiplayer server

There is no such thing as admin on a normal local server. You're able to do everything.

In case you're playing on a dedicated server

<span>In the server command prompt, make a RCON command which states: ulx adduser <your user name> superadmin. This will add you as superadmin, using the </span><span>ULX admin addon.</span>
4 0
3 years ago
Read 2 more answers
Stuart wants to delete some text from a slide. What should Stuart do?A. From the Review tab, choose Highlight text and then pres
Anna [14]
C. Highlight the text to be deleted, right-click and choose Cut
5 0
3 years ago
Read 2 more answers
Every application program has a _______________ segment
Natali5045456 [20]
"Main" goes in the blank. For example in C++ all of your code goes in the main function.
4 0
3 years ago
.Although SQL is a language, you don’t use it to write applications? (true, false)
Olin [163]

Answer:

The correct answer for the given question is true .

Explanation:

SQL is an Structural query language that is used for accessing the database basically it is an query language which is used for communicating with database by executed the query .

The following are the function of SQL  

SQL can insert the data into database

it can update the record into database

SQL can retrived the database.

We do not use SQL for writing application it is only used to accessing the database  

For create application we can use programming language Like PHP,ASP,JAVA ,PYTHON.etc.

3 0
3 years ago
Question 9. which describes an str?
Nadya [2.5K]
<span><span>STR stands for Short Term repeat. It is </span>a region of a DNA molecule that contains short segments of three to seven repeating base pairs</span>
<span>Hundreds of different types of STR's are found in the human genomes.</span>
3 0
3 years ago
Other questions:
  • Pointsfor a failover cluster, what type of network would you use to communicate with an iscsi device?
    15·1 answer
  • Suppose an instruction takes 4 cycles to execute in an unpipelined CPU: one cycle to fetch the instruction, one cycle to decode
    10·1 answer
  • 4. An advantage presented by straight-in spaces is that
    12·1 answer
  • Professionalism is defined as what?<br> ASAP PLEASE!
    11·1 answer
  • Robert's employer has agreed to pay half the tuition for Robert to complete his college degree. This benefit is known as what?
    7·2 answers
  • 27. If X and Y are int type variables,
    14·1 answer
  • Why would a programmer use a flow chart? (Edge2020 Coding Critical Thinking Questions)
    9·1 answer
  • In this exercise we will practice using loops to handle collections/containers. Your job is to write a program that asks the use
    6·1 answer
  • Transitive spread refers to the effect of the original things transmitted to the associate things through the material, energy o
    6·1 answer
  • How to set Campaign goals?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!