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
Semenov [28]
4 years ago
9

Using a conditional expression, write a statement that increments num_users if update_direction is 3, otherwise decrements num_u

sers. Sample output with inputs: 8 3 New value is: 9
Engineering
1 answer:
yuradex [85]4 years ago
6 0

Answer:

num_users = (update_direction == 3) ? (++num_users) : (--num_users);

Explanation:

A. Using the regular if..else statement, the response to the question would be like so;

if (update_direction == 3) {

  ++num_users;  // this will increment num_users by 1

}

else {

 -- num_users;    //this will decrement num_users by 1

}

Note: A conditional expression has the following format;

<em>testcondition ? true : false;</em>

where

a. <em>testcondition </em>is the condition to be tested for. In this case, if update_direction is 3 (update_direction == 3).

b. <em>true </em>is the statement to be executed if the <em>testcondition</em> is true.

c. false is the statement to be executed it the <em>testcondition</em> is false.

B. Converting the above code snippet (the if..else statement in A above) into a conditional expression statement we have;

num_users = (update_direction == 3) ? (++num_users) : (--num_users);

<em>Hope this helps!</em>

You might be interested in
Base course aggregate has a target dry density of 119.7 lb/cu ft in place. It will be laid down and compacted in a rectangular s
natita [175]

Answer:

total weight of aggregate =  5627528 lbs = 2814 tons  

Explanation:

given data

dry density = 119.7 lb/cu ft

area = 2000 ft × 48 ft × 6 in

aggregate = 3.1%

required compaction = 95%

solution

we get  here volume of space to be filled with aggregate that is

volume = 2000 × 48 × 0.5 = 48000 ft³

when here space fill with aggregate of density is

density = 0.95 × 119.7    = 113.72 lb/ft³

and

dry weight of this aggregate will be  is

dry weight = 48000 × 113.72 = 5458320 lbs

and

we consider take percent moisture by weigh so that there weight of moisture in aggregate is express as

weight of moisture = 0.031 × 5458320 = 169208 lbs

and

total weight of aggregate will be

total weight of aggregate = 5458320 + 169208

total weight of aggregate =  5627528 lbs = 2814 tons  

5 0
3 years ago
What are the approximate solutions to the quadratic function x^2+6x-4=0
posledela
Solve the equation for
x
x
by finding
a
a
,
b
b
, and
c
c
of the quadratic then applying the quadratic formula.
Exact Form:
x
=
3
±
√
13
x
=
3
±
13
Decimal Form:
x
=
6.60555127
…
,
−
0.60555127
…
x
=
6.60555127
…
,
-
0.60555127
…
6 0
3 years ago
In vehicles equipped with an anti-braking system the drivers foot must remain firmly on the
Murrr4er [49]
... brake pedal; In vehicles equipped with ABS, the driver's foot remains firmly on the brake pedal, allowing the system to automatically pump the brakes.

“Brake Pedal.”
3 0
3 years ago
Read 2 more answers
I have to find the critical points of this function of two variables <img src="https://tex.z-dn.net/?f=%5C%5Cf%28x%2Cy%29%3Dx%5E
liraira [26]

Answer:

no i dont think there is

Explanation:

because theres not

4 0
4 years ago
A circuit contains four 100 ohm resistors connected in series. If you test the circuit with a DMM you should read a total resist
olga nikolaevna [1]
C is the correct answer
8 0
3 years ago
Other questions:
  • A state of stress that occurs at a point on the free surface of the of a solid body is = 50 MPa σ x , =10 MPa σ y , and = −15 MP
    8·1 answer
  • Beryllium (Be) has an HCP unit cell for which the ratio of the lattice parameters c/a is 1.568. If the radius of the Be atom is
    10·1 answer
  • A waste treatment pond is 50m long and 25m wide, and has an average depth of 2m.The density of the waste is 75.3 lbm/ft3. Calcul
    12·1 answer
  • What are the desired characteristics or values for the following parameters of an ideal amplifier?o Phase change as a function o
    10·1 answer
  • Guys, can you rate this toolbox, please. It is my DT project, made for car trips, what do you think of the idea/design/usability
    12·1 answer
  • 5-81 The shaft is made of A-36 steel and is fixed at end D, while end A is allowed to rotate 0.005 rad when the torque is applie
    6·1 answer
  • Storing parts outside doesn't cause any environmental risks as long as the items are covered.
    12·2 answers
  • Compare and contrast the roles of agricultural and environmental scientists.
    11·1 answer
  • BOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    7·1 answer
  • Beyond providing a visual representation of an object for the creator, what are the advantages of using CAD software to create 3
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!