Hello, I've wrote this code
When I launch it, it displays everything.
for example if I write = 5, it will display like this
You got F
You got D
You got C
You got B
you got A
I'm also a newbie at programming haha.
I'm not entirely sure on the reason why, but it's in good programming practice not to put them after "if" statements.
This is from Beginning c++ through game programming.
"you don't use a semicolon after the closing parenthesis of the expression you test in an if statement. If you were to do this, you'd create an empty statement that would be paired with the if statement, essentially rendering the if statement useless. "
Basically it ignores the if statement and displays all the information after the if statement, regardless of the argument being true or false.
This is quoted off another post in a different forum.
">whats the reason behind using int main over void main?
Because the standard dictates that every C/C++ program must return a value to indicate its success. It also says that a program must return either 0 or EXIT_SUCCESS if the execution was successful. Declaring main() as void doesn't mean the program won't return a value -- it just means that the value it returns will probably not be 0.
And that's bad because now the operating system thinks that the execution failed. Other horrible things can happen, too. The excuse "it works for me" is not valid because it's quite possible it will eventually screw you up, and you probably don't want to spend hours looking for a bug that came of bad coding habits."