Good Morning,
My name is Greg and I am trying to teach myself to write code. But I have a question I wrote a program that compares a range of numbers and tells you the grade. The program works and dose what it is supposed to do but I have some questions.
1) When you compare a range such do you use && or do you use the or statement to compare them? As I understand them when you and both conditions must be ture and with an or statement only one has to be ture. So then can they both not work to compare a range of numbers?
2) In c++ you can use the word "and" or the && do these have the same effect?
3) When you are useing nested if-then-else such as these do you nest the parenthese such as in the first if statement? When you nest them how dose this work? Is like the order of opprations where the parenthese are done first or is it read left to right just like it is typed in?
if((gradeIn >= 0) && (gradeIn <= 49 )) {
cout << " You fail try again "<< endl ;
} else if (gradeIn >= 50 and gradeIn <= 69 ){
cout << " Your grade is " << gradeIn <<" You passed "<< endl;
Thank you,
Greg