Answer:
#include <iostream>
using namespace std;
int main()
{
int userNum;
cout<<"Enter a number"<<endl;
cin >> userNum;
if (userNum > 0){
cout << "Positive." << endl;
}
else{
cout << "Not positive, converting to 1." << endl;
userNum=1;
}
cout<<"Final: "<<userNum<<endl;
return 0;
}
Step-by-step explanation:
The code as implemented above will prompt the user to enter a number, read and save the number in a variable (userNum)
Using if/else statements, if the number is greater than 0 (i.e positive),it outputs Positive
else it assigns a new value of 1 to the number and outputs the final value