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
Whitepunk [10]
4 years ago
15

1)Create a conditional expression that evaluates to string "negative" if userVal is less than 0, and "positive" otherwise. Examp

le output when userVal = -9 for the below sample program:
-9 is negative.
#include
#include

int main(void) {
char condStr[50] = "";
int userVal = 0;

userVal = -9;

strcpy(condStr, /* Your solution goes here */);

printf("%d is %s.
", userVal, condStr);

return 0;
}

2)

Using a conditional expression, write a statement that increments numUsers if updateDirection is 1, otherwise decrements numUsers. Ex: if numUsers is 8 and updateDirection is 1, numUsers becomes 9; if updateDirection is 0, numUsers becomes 7. Hint: Start with "numUsers = ...".

#include

int main(void) {
int numUsers = 0;
int updateDirection = 0;

numUsers = 8;
updateDirection = 1;

/* Your solution goes here */

printf("New value is: %d
", numUsers);

return 0;
Computers and Technology
2 answers:
SSSSS [86.1K]4 years ago
7 0
1. userVal < 0 ? "negative" : "positive"

2. updateDirection == 1 ? numUsers++ : numUsers--;
Licemer1 [7]4 years ago
5 0

Answer:

1:

if userVal<0

cout <<" negative":

userVale >0

cout<<"positive":

2:

if

updateDirection ==1;

numUsers++;

cout<<"numUser"

else

numUser--;

cout<<"numUser";

You might be interested in
Simple question: what is bandwidth?
katen-ka-za [31]
The maximum amount of data transmitted over an internet connection in a given amount of time
8 0
3 years ago
Read 2 more answers
When designing a laptop, which three things should designers think about?
FromTheMoon [43]

Answer:B,C,D

Explanation:

7 0
3 years ago
What does % find on edhesive??
statuscvo [17]

Answer:

Explanation: What is that word you typed?

3 0
3 years ago
Which best explains why the world first civilizations developed in river valley's
fiasKO [112]
They need to be close to a body of water and being in a valley is good because they are protected because they have mountains around
4 0
3 years ago
Pls help me, it's due today​
Leviafan [203]

Answer:

1. Electronic devices

2. B= Headphones, C= projector, d= computer, e= speakers, g= printer

Explanation:

i dont know  what A and F are sorry

6 0
3 years ago
Read 2 more answers
Other questions:
  • Why is Copyright important?
    5·1 answer
  • The technology Herman Hollerith created in the 1880s began the modern-day data processing function in computers.
    5·1 answer
  • In order for an IT security framework to meet information assurance needs, the framework needs to include policies for several a
    13·1 answer
  • An op amp requires the design equation vout = 50vin 3vref agvg. what is the value of ag?
    7·1 answer
  • Write a function that implements another stack function, peek. Peek returns the value of the first element on the stack without
    11·1 answer
  • The UNIX system does not attempt to avoid cycles. Instead, it restricts access to the linking capability of the system. Normal u
    11·1 answer
  • Which similar computer network components connect multiple devices?
    11·2 answers
  • Match each method of communication with its intended purpose.
    14·1 answer
  • In your guessing game, you replaced dashes in blanks when the user guessed a correct letter by using a string slice. Which line
    6·1 answer
  • What is the earliest age you can collect social security.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!