So yeah, I haven't really posted in a while, due to me not really doing anything in C++ due to school. But picking up now once more. Anyways, I've just been starting, so yeah. I'm doing lessons from pretty much everywhere now, I learn something new from every other book, whether it be the first lesson.
So yeah, I was reading the 2nd Lesson on Cprogramming.com and I got really confused at one part. ._.
A. !( 1 || 0 ) ANSWER: 0
B. !( 1 || 1 && 0 ) ANSWER: 0 (AND is evaluated before OR)
C. !( ( 1 || 0 ) && 0 ) ANSWER: 1 (Parenthesis are useful)
AND OR NOT. The three operators of Boolean. Can someone explain to me what they mean? Like I know that !=not ||=or &&=and.
But I mean, how they are used, and if possible, can you give me an example in a code, cause it's much easier for me to understand. Also, since I don't want to repost another thread. The break statement is used to break loops, correct? And the continue statement skips to the next part of the code? ._.;
Sorry if it sounds confusing, but yeah. I'm still not finished Basics due to school, but I have 2 weeks of in which I intend to cover most of the basics.
Thanks to those help, and thank you for your time.
EDIT: An example I tried was
Code:
int main()
{
int a=10;
if (a != 20){
cout <<"Hi. I'm failing basics.";
}
return 0;
}
I understand that example, because it basically means if a does not equal 20, print the following. But I mean, the other ones are confusing to me, mostly or as well as and.