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
Alisiya [41]
3 years ago
10

Create a conditional expression that evaluates to string "negative" if userVal is less than 0, and "non-negative" otherwise. Ex:

If userVal is -9, output is:
-9 is negative. PLEASE USE C++
Computers and Technology
1 answer:
Goryan [66]3 years ago
5 0

Answer:

PROGRAMMING APPROACH:

  • Define the necessary header file using namespace.
  • Define the main() method.
  • Declare variable inside the function().
  • Print result.

Explanation:

Required C++ Code:

#include<iostream>

#include<string>

using namespace std;

int main()

{

  string condStr;

  int userVal;

  cin>>userVal;

  condStr=(userVal<0)?("negative"):("non-negative");

  cout<<userVal<< " is "<< condStr <<"."<<endl;

}

OUTPUT:

-2

-2 is negative.

You might be interested in
Rebecca is an interior designer. What is her job role? need this asap
Solnce55 [7]
B. to decorate and renovate homes
5 0
3 years ago
What format can be applied to text in Excel?
vladimir2022 [97]

Answer:

You can apply accounting format,date,numbers, currency, percentage or even fraction

Explanation:

3 0
3 years ago
Write a program in Java programming language to display or calculate “Hello, Daddy and Mum”
olganol [36]

Answer:

class Simple{

public static void main(String args[]){

System.out.println("Hello Daddy and Mum);

}

}

Explanation:

First, we create a class, then a method and then give the Integrated Data Environment (IDE) the command to give out an output that says Hello, Daddy and Mum”

8 0
3 years ago
What is the function of the command prompt?
yan [13]
The answer is B cause you use it to make commands
6 0
3 years ago
Form the recurrence relations (RRs) for the number of vertices and the number of edges of a hypercube of n dimensions, Hn. Solve
Rus_ich [418]
I'll write it below Step-by-step explanation: Q1 a side that has 10 sides and 10 angles is called decagon. Q2 it is nonagon Q3 it is Pentagon Q4it is heptagon
8 0
3 years ago
Other questions:
  • TCP has a 32-bit sequence number field and 16-bit advertised window field. Assume that RTT is 512 (2 9 ) ms, transmission speed
    6·1 answer
  • When choosing a new computer to buy, you need to be aware of what operating _____ a0 it uses.
    6·1 answer
  • Select the correct answer
    11·2 answers
  • A Color class has a constructor that accepts three integer parameters: red, green and blue components in the range of 0 ... 255
    6·1 answer
  • Write a program that reads an integer, a list of words, and a character. The integer signifies how many words are in the list. T
    9·1 answer
  • Write a program that prompts the user to enter a number then counts the number of odd numbers and even numbers the user enter. T
    15·1 answer
  • Analyzing the role of elements in audio editing and Video
    7·1 answer
  • You are about to repair and change the resistor (small components),but the components are too small to solder and hold,what tool
    12·1 answer
  • Which design monument beginning with A inspired the chrysler building in New York​
    14·1 answer
  • A scanner connected to your mac is giving problems and you suspect corrupted device drivers. What should you do first? second?.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!