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
Ulleksa [173]
4 years ago
10

Write a function MaxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the function in

a program that takes two integer inputs, and outputs the largest magnitude value. Ex: If the inputs are: 5 7 the function returns: 7 Ex: If the inputs are: -8 -2 the function returns: -8 Note: The function does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the absolute-value built-in math function. Your program must define and call a function: int MaxMagnitude(int userVal1, int userVal2)
Engineering
1 answer:
Svetradugi [14.3K]4 years ago
3 0

Answer:

The function requires evaluate the largest magnitude (the largest value withou sign), so we need to compare the absolute value of the two inputs number. For that we use the abs() function.

The code is as follows, with the comments after // and in italic font:

#include <iostream>   <em>//module for input/output stream objects</em>

#include <cmath>  <em>//math module </em>

using namespace std;

<em>// follows the function definition  </em>

int MaxMagnitude (int userVal1, int userVal2) {

 int Max=0;    <em>//define output variable Max</em>

 if (abs(userVal1) > abs(userVal2)) {  <em>// compare magnitude </em>

   Max = userVal1;  <em> //if Val1 is larger than val2 Max is Val1</em>

 }

 else {

   Max = userVal2;  <em>//else the max is Val 2 </em>

 }

 return Max;  <em>//the value returned for this function</em>

 }

// <em>in main we will use the defined function MaxMagnitude</em>

int main() {

  int one = 0;

 int two = 0;

 cin >> one;  //assignation of the first user input to one  

 cin >> two;   //assignation of the second user input to two  

//we call the function using as input the read values

//and write the return of the function, all at once  

  cout << MaxMagnitude(one, two) << endl;  

  return 0;

}

You might be interested in
Legal metrology would protect consumers from businesses that do not take measurements according to defined measuring regulations
sergij07 [2.7K]

From what my research concluded, true

5 0
4 years ago
In contouring, it is necessary to measure position and not velocity for feedback.
EastWind [94]

Answer:

(1). False, (2). True, (3). False, (4). False, (5). True.

Explanation:

The term ''contouring'' in this question does not have to do with makeup but it has to deal with the measurement of all surfaces in planes. It is a measurement in which the rough and the contours are being measured. So, let us check each questions again.

(1). In contouring, it is necessary to measure position and not velocity for feedback.

ANSWER : b =>False. IT IS NECESSARY TO MEASURE BOTH FOR FEEDBACK.

(2). In contouring during 2-axis NC machining, the two axes are moved at the same speed to achieve the desired contour.

ANSWER: a=> True.

(3). Job shop is another term for process layout.

ANSWER: b => False

JOB SHOP IS A FLEXIBLE PROCESS THAT IS BEING USED during manufacturing process and are meant for job Production. PROCESS LAYOUT is used in increasing Efficiency.

(4). Airplanes are normally produced using group technology or cellular layout.

ANSWER: b => False.

(5). In manufacturing, value-creating time is greater than takt time.

ANSWER: a => True.

8 0
3 years ago
If you are a government authority what extend will you modify the existing policy
mr_godi [17]

Answer:

kk

Explanation:

dkdndidodd ndidkjeeiwonejeeidmdnddkdidfmndd

4 0
4 years ago
Chemical manufacturers must present which information on the product's label?
Wewaii [24]

Answer:

hazardous chemicals leaving the workplace is labeled, tagged or marked with the following information: product identifier; signal word; hazard statement

Explanation:

this is so you know what chemicals are in it

6 0
4 years ago
What happens to resistance in the strain gage and voltage drop from a connected Wheatstone bridge if you were to pull the strain
snow_tiger [21]
The resistance and voltage drop will still increase but at a smaller rate than the intended axis such as the long axis.
3 0
3 years ago
Other questions:
  • A signalized intersection approach has an upgrade of 4%. The total width of the cross street at this intersection is 60 feet. Th
    15·1 answer
  • To become familiar with the general equations of plane strain used for determining in-plane principal strain, maximum in-plane s
    9·1 answer
  • An engineer is designing an irrigation system to bring water to a farm. Which
    12·2 answers
  • PLEASE HELP! ASAP!!!!
    6·1 answer
  • A three-point bending test was performed on an aluminum oxide specimen having a circular cross section of radius 5.0mm (0.20 in.
    6·1 answer
  • A fuel oil is burned with air in a furnace. The combustion produces 813 kW of thermal energy, of which 65% is transferred as hea
    13·1 answer
  • Assume there exists some hypothetical metal that exhibits ferromagnetic behavior and that has (1) a simple cubic crystal structu
    6·1 answer
  • Determine the wattmeter reading when it is connected to resistor load.​
    11·1 answer
  • A 12 kg hockey puck is traveling at a velocity of 15 m/s. What is the momentum?
    7·1 answer
  • Which of the following maintenance items helps to ensure the vehicles engine lasts as long as possible?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!