Answer:
PROGRAMMING APPROACH:
- Define the necessary header file using namespace.
- Define the main() method.
- Declare variable inside the function().
- Print result.
Step-by-step 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.