glennlopez / Cpp.Playground

:octocat: educational repo for storing my practice sessions with ASM, C and C++ as well as solutions to online courses I take relating to ASM, C, and C++ programming

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

3.3.2 if-else statement for zybook

johncase opened this issue · comments

#include
using namespace std;

int main() {
int userNum1;
int userNum2;

userNum1 = 0;
userNum2 = 14;

if (userNum1 < 0) {
cout << "userNum1 is negative." << endl;
}
if (userNum2 <= 12) {
cout << "userNum2 is less than or equal to 12." << endl;
}
if (userNum2 > 12) {
userNum2 = 0;
}
else (userNum2 = userNum2);
cout << "userNum2 is " << userNum2 << endl;

return 0;
}