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]
3 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]3 years ago
7 0
1. userVal < 0 ? "negative" : "positive"

2. updateDirection == 1 ? numUsers++ : numUsers--;
Licemer1 [7]3 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
How does the technology affect you daily living? Give situations where you use technology and how it helped you.​
Fiesta28 [93]

Answer:

Great!

Explanation:

I use mobile phone and i use it as exmergency phone

5 0
3 years ago
Debug
Snowcat [4.5K]
Wait what’s the question tho??
6 0
3 years ago
Define and implement a method that takes a string array as a parameter and returns the length of the shortest and the longest st
Drupady [299]

Answer:

#HERE IS CODE IN PYTHON

#function to find length of shortest and longest string in the array

def fun(list2):

   #find length of shortest string

   mn=len(min(list2))

   #find length of longest string

   mx=len(max(list2))

   #return both the value

   return mn,mx

#array of strings

list2 = ['Ford', 'Volvo', 'BMW', 'MARUTI','TATA']

# call the function

mn,mx=fun(list2)

#print the result

print("shortest length is:",mn)

print("longest length is:",mx)

Explanation:

Create an array of strings.Call the function fun() with array as parameter. Here min() function will find the minimum string among all the strings of array and then len() function will find its length and assign to "mn". Similarly max() will find the largest string and then len() will find its length and assign to "mx". Function fun() will return "mn" & "mx".Then print the length of shortest and longest string.

Output:

shortest length is: 3

longest length is: 5

7 0
3 years ago
When was microsoft word for windows invented?
Dahasolnce [82]
1981 fue inventado por Bill gates y paul allen
4 0
3 years ago
In business documents, spacing between columns needs to be _____. 0.25 inches as little as possible as wide as possible proporti
LenKa [72]
In business documents, spacing between columns needs to be proportional to the text because when spacing between columns, you don't want your text or writing to be too far apart but you want it pretty close/equivalent so the text can be correct.
7 0
3 years ago
Read 2 more answers
Other questions:
  • 4. When you're working with a word processing document and you press the Del key, what happens?
    8·2 answers
  • Why do we allow electronic instruments to warm-up before use?
    11·1 answer
  • An exclusion contract A. gives a firm the right to be the exclusive provider of a good in a particular market. B. is a form of e
    13·1 answer
  • You're a ticket agent for a commercial airline and responsible for checking the identification for each passenger before issuing
    13·1 answer
  • What happens if the user sysadmin invokes the mail command interface and there are no unread mail messages?
    13·1 answer
  • What is processing requirement in computer?
    11·1 answer
  • How is science and technology used in the society​
    11·1 answer
  • 3.5 Code Practice: Question 1<br> (Website: Edhesive)
    14·1 answer
  • Helpppppppppppppppppppppppppppppppp
    13·2 answers
  • If you added the formula =SUM(B1:B5) to a spreadsheet, what would it do?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!