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
Identify disadvantages that web designers encountered when using tables for page layout. Check all of the boxes that apply.
11Alexandr11 [23.1K]

Answer:

A and C

Explanation:

I got the question correct on Edge.

7 0
3 years ago
Read 2 more answers
A mechanic uses a screw driver to install a ¼-20 UNC bolt into a mechanical brace. What is the mechanical advantage of the syste
velikii [3]

Answer:

15.7 ; 78.5

Explanation:

Mechanical advantage of a screw = Circumference / pitch

Circumference = pi × d

Where :

pi = 3.142, D = diameter

Therefore ;

Circumference = 3.142 × (1/4) = 0.785 in

Pitch = 1/TPI

TPI (thread per inch) = 20

Pitch = 1/ 20 = 0.05

Mechanical advantage = 0.785 / 0.05 = 15.7

Resistance force if effort force is 5lb

Mechanical advantage = Fr / Fe

Fe = effort force, Fr = resistance force

15.7 = Fr / 5

Fr = 15.7 × 5 = 78.5 lbs

7 0
3 years ago
Why is it necessary to understand conflict of interest and how it could affect you at work​
Anastasy [175]

Answer:

Conflict of interest is a common issue in the workplace. Most of us have heard someone say, “It’s who you know, not what you know.” We have heard co-workers complain that a manager’s relative always gets the biggest raise or the best assignment. We might have seen colleagues accept gifts from potential vendors. Maybe a co-worker leaves work 20 minutes early every day so she can get to her second job. A supervisor may give a co-worker time off from work to do volunteer work or might allow employees to solicit donations and funds in the workplace, whether for the Girl Scouts or a local school function. Even though these situations are very different, they all fall under the heading of “conflict of interest.”

Explanation:are a clash that most often occurs between requirements and interests. Various types of conflicts of interest can occur because of the nature of relationships versus rules of organizations or federal and state laws. People can easily become biased (have an unfair preference) because of small things like friendship, food, or flattery, or they may be influenced to make a decision because of the potential to gain power, prestige, or money. Conflicts can occur when an individual makes or influences a decision and does so for some personal gain that may be unfair, unethical, or even illegal. The important part is what you do in each of those situations. Do you allow your family, friendship, financial, or inside knowledge affect your actions? If you do, you could be violating state statute and university policy.

In our work lives, we also have interests that could influence the way we do our jobs and the decisions we make. Even if we never act on them, there may be an appearance that a conflict of interest has influenced our decisions. Consider this example. Your supervisor is promoted to department director. His daughter-in-law is hired as a new supervisor within the college but is not reporting to him. Maybe the new supervisor is the best candidate for that position, and maybe the new department director had nothing to do with her hire. Even if this hire met all of the requirements under our Employment of Relatives policy, the situation appears suspicious and employees may think that something was unfair or unethical about her hire.

Transparency (being completely open and frank) becomes important when dealing with both actual and potentially perceived conflicts of interest. Perception happens when an individual observes something (behavior or activity) and comes to a conclusion. Perceiving a conflict of interest does not make it a conflict of interest. The true test of verifying whether a matter is just a potentially perceived conflict of interest, or an actual conflict of interest, is disclosure.

7 0
4 years ago
2. Write these functions definitions:
GREYUIT [131]

Answer:

Complete the code with the following code segment:

void add2Numbers(){

   int num1, num2;

   cout<<"Enter any two numbers: ";

   cin>>num1>>num2;

   cout<<num1+num2;

}

void sub2Numbers(){

   int num1, num2;

   cout<<"Enter any two numbers: ";

   cin>>num1>>num2;

   cout<<num1-num2;

}

void mul2Numbers(){

   int num1, num2;

   cout<<"Enter any two numbers: ";

   cin>>num1>>num2;

   cout<<num1*num2;

}

void div2Numbers(){

   int num1, num2;

   cout<<"Enter any two numbers: ";

   cin>>num1>>num2;

if(num2==0){

cout<<"Division by 0 is invalid";

}else{

   cout<<(float)num1/num2;}

}

Explanation:

The function added to this solution are:

  • add2Numbers
  • sub2Numbers
  • mul2Numbers
  • div2Numbers

Each of the functions

  • declares two integers num1 and num2
  • prompt user for inputs
  • gets user inputs from the user

For add2Numbers() function:

This line adds the two integer numbers and prints the result

   cout<<num1+num2;

For sub2Numbers() function:

This line subtracts the two integer numbers and prints the result

   cout<<num1-num2;

For mul2Numbers() function:

This line multiplies the two integer numbers and prints the result

   cout<<num1*num2;

For div2Numbers() function:

This if condtion checks if the denominator is 0

if(num2==0){

If yes, the following is printed

cout<<"Division by 0 is invalid";

If otherwise, the division is calculated and the result is printed

   cout<<(float)num1/num2;

<em>See attachment for complete program</em>

Download cpp
7 0
3 years ago
Write some general rules used while chatting​
Tpy6a [65]

Answer:

Well,

Explanation:

Well, this topic is a very broad one and I'm not exactly sure what kind of information you' like provided, but I got a few ideas in mind.

While chatting online, a big letdown for most people is if you curse and especially if you do it excsessivley. Doing so will make you seem toxic and most people would just try to avoid you.

Talking about toxicity, being a toxic person online is petty and quite pathetic. Gloating and raising your ego won't make you any more of a liekable person online, or even in the real world.

Last but not least, another general rule of online chatting is to make sure you know who you're talking too. Talking to strangers online can be very dangerous, in some cases leading to things like pedophilia etc.

3 0
3 years ago
Other questions:
  • Redo Programming Exercise 16 of Chapter 4 so that all the named constants are defined in a namespace royaltyRates. PLEASE DONT F
    14·1 answer
  • What are 7 key traits for knowing your audience
    6·2 answers
  • I need help in creating a Java Program; To calculate the chapter from which you solve the programming exercise, below are the re
    7·1 answer
  • On the piano, the pitches/notes used on the bass clef are located on what part of the keyboard?
    9·2 answers
  • How do you optimize a website using JavaScript?
    10·1 answer
  • With simple segmentation, a process is divided into a number of segments that need not be of equal size. When a process is broug
    5·1 answer
  • Write a function that receives an integer (n) argument and then computes the following based on the value of the integer: While
    13·1 answer
  • Which of the following is an approach to debugging?
    7·2 answers
  • Я люблю есть гнезда петух
    11·1 answer
  • Question 1 (1 point)
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!