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
The ability of services to grow or shrink based on need is called __________.
Talja [164]
This kind of ability is called rapid elasticity. The resources can be maximized by a consumer to provide wider webs and applications.It can also make the server stop, just to reduce the cost in the process.  The flexibility in adapting to needs of a company is an advantage. Rapid elasticity can be done in a public cloud.
3 0
3 years ago
Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
Taya2010 [7]

Answer:

Attached is a screenshot of my code for 'PasswordGenerator' and the tests necessary.

Explanation:

If you need any explanation, please ask!

3 0
2 years ago
Read 2 more answers
What is 2D thinking and 3D thinking? i literally don't understand
andriy [413]

Answer:

Two dimensional thinking implies concepts that are flat or only partially representative of the whole. Three dimensional thinking implies the first part of 2d thinking conjoined with intersecting dimensions rendering a deeper field of meaning.

Explanation:

8 0
2 years ago
Create an interactive program to use class a LightsOut class to allow a user to play a game. Each step in the game will require
expeople1 [14]

Answer:

9+10=21

Explanation:

wyd boy

8 0
3 years ago
Which trait depicts honesty?
Aliun [14]

(B) reporting additional cash found in the cash register

5 0
3 years ago
Other questions:
  • A program to add two numbers in C++
    15·1 answer
  • Periodically adding, changing and deleting file records is called file. A) Updating B) Upgrading C) Restructuring D) Renewing E)
    10·2 answers
  • HELP AS SOON IS A UNIT TEST WILL GIVE BRAINLIEST
    9·2 answers
  • 5. Which of the following is a Windows feature that allows you to temporarily store text?
    13·2 answers
  • The document responsible for describing the type of data stored in the database is called the:
    5·1 answer
  • Whenever Jim starts his laptop, he sees some commands and numbers appearing on his screen. These instructions are being processe
    12·2 answers
  • A research team is studying parallel computing. They want to run parallel processes without having to use multiple processors. H
    15·2 answers
  • In Vista and Windows 7, the Appearance and Personalization option allows you to change the
    14·1 answer
  • Write any four difference between email and effects​
    14·1 answer
  • Please answer this question​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!