Created
December 4, 2020 08:21
-
-
Save mattsegura/e7d64bf21b59ad92c3d7dba2f156884f to your computer and use it in GitHub Desktop.
simple else if statement utilizing a menu system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int books, points, month; | |
cout << "How many books have you purchased this semester?\n"; | |
cin >> books; | |
if (books == 0) | |
{ | |
cout << "You earn 0 points"; | |
} | |
else if (books == 1) | |
{ | |
cout << "You earn 5 points"; | |
} | |
else if (books == 2) | |
{ | |
cout << "You earn 15 points"; | |
} | |
else if (books == 3) | |
{ | |
cout << "You earn 30 points"; | |
} | |
else if (books >= 4) | |
{ | |
cout << "You earn 60 points"; | |
} | |
else | |
{ | |
cout << "Wrong input, please choose the right number\n"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment