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
or each array created, the name of the array becomes the name of the pointer constant created by the compiler for the array, and
JulijaS [17]

Answer:

The answer is "Starting address"

Explanation:

Arrays are a type of data structure that can store a fixed size successive assortment of components of a similar kind. An Array is used to store an assortment of data, yet it is regularly more valuable to consider a cluster an assortment of factors of a similar sort.

Rather than proclaiming singular factors, for example, number0, number1, ..., and number99, you declare one Array variable, for example, numbers and use numbers[0], numbers[1], and ..., numbers[99] to speak to singular factors. A particular component in a cluster is gotten to by a list.

All Arrays comprise of bordering memory areas. The most minimal address compares to the first element and the most highest address to the last element.

4 0
2 years ago
Mary uploaded some images on her website. She chose an image and downloaded it. She found that the image she saw on screen did n
zalisa [80]

Answer:

A.

Some image resolution was lost while uploading it

As she uploaded them on her website not downloading as choice B&D show while E is false and C is rarely occur

7 0
3 years ago
Select the correct answer from each drop-down menu.
xz_007 [3.2K]

Answer:

Maths operators

cell reference

5 0
2 years ago
The readline method reads text until an end of line symbol is encountered, how is an end of line character represented
zhannawk [14.2K]

Answer:

\n

Explanation:

readline() method is used to read one line from a file. It returns that line from the file.    

This line from the file is returned as a string. This string contains a \n at the end which is called a new line character.

So the readline method reads text until an end of line symbol is encountered, and this end of line character is represented by \n.

For example if the file "abc.txt" contains the lines:

Welcome to abc file.

This file is for demonstrating how read line works.

Consider the following code:

f = open("abc.txt", "r")  #opens the file in read mode

print(f.readline()) # read one line from file and displays it

The output is:

Welcome to abc file.    

The readline() method reads one line and the print method displays that line.                        

3 0
3 years ago
EXERCISE
nirvana33 [79]

Answer:

1. True

2. True

3. False

4. True

5. True

8 0
2 years ago
Other questions:
  • A page-replacement algorithm should minimize the number of page faults. We can achieve this minimization by distributing heavily
    14·1 answer
  • How useful is the creation of folders for your computer
    9·1 answer
  • What will the output be from the following program?
    5·1 answer
  • Which of the following are valid values for a boolean value in programming? (Select all that apply)
    8·1 answer
  • When evaluating portable CD players, you consider price, the sound quality, and ease of using the controls. These are your _____
    8·2 answers
  • It is unlawful in the State of Florida for any person, ______________________, to be a passenger in the front seat of a motor ve
    7·1 answer
  • I love the brainly update guys! :)
    5·2 answers
  • What are the routes through with Virus transmitted into computer<br>system?​
    15·1 answer
  • Sampson runs his own online business, and much of his success depends on the reliability and accuracy of various online data. Ho
    11·1 answer
  • Define management styles
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!