Answer to Question #99415 in C++ for Caleb

Question #99415
Re-type the code and fix any errors. The code should convert non-positive numbers to 1.
if (userNum > 0)
cout << "Positive." << endl;
else
cout << "Not positive, converting to 1." << endl;
userNum = 1;

cout << "Final: " << userNum << endl;
1
Expert's answer
2019-12-10T13:23:32-0500
    if (userNum > 0) {
        cout << "Positive." << endl;
    }
    else {
        cout << "Not positive, converting to 1." << endl;
        userNum = 1;
    }
    cout << "Final: " << userNum << endl;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS