C++

Hello I need some help with c++.

I need to write a program that promts the user to enter a number between 5 and 14. If the user enters a number between those numbers then it is suppose to display GREAT if not LOSER

Do you understand:
-how to use std::cin
-how to use if statements (and else statements)
-how to use logical operators in conjunction with if statements

If you do, you have this program in the bag.
This is what I have so far

int (i

if (i % 10 >=5; i<=14
{
cout << "GREAT.";
}
else
{
cout << "LOSER.";
}
It's a good start.

int (i
I think you mean:
int i;

You need to ask the user to input a number, and then input it into i.

if (i % 10 >=5; i<=14
This is definitely not right, but it's close.
1. You're missing the closing parenthesis ")"
2. you don't use semicolons inside of if statements
3. % is modulus, which is remainder of division, and you certainly don't want to sue it for this program. I don't know where you got that 10 from either.
4. Be careful, the word "between" means between and not including (at least for most tests and exams where I live).
Last edited on
Topic archived. No new replies allowed.