Hello, welcome to the 13th tutorial in the c++ programming series and in this poem in looking at the relation and comparison operators, to individual expression can be compared against each other using relational or equality operators. For example, to check if two values are equal to each other, the result of these types of operations is a Boolean aka true or false date and if the condition was true or not, so let's go ahead and open up a project to show you how to implement these operators. Okay, so what we're gonna do is simply get rid of this, get rid of this. Wow. And there are a total of six operators that we're going to show you. The first one is the double equals which is that which is basically checking if something is equal to something else.
Next one is p not equal operator, which is obviously the opposite of this one, let's check in if something is not equal to something else, value variables and so forth. The next one is the left hand to check if the value on the left is less than the value on the right. The next one, often you should be able to guess if greater. Now we've just checked it, the value on the left is greater than the value on the right. Nothing less than or equal to with just checks if the value on the left is less than or equal to the value on the right. The operator after this one Finally, is greater than or equal to just check if the value on the left is greater than or equal to the value on the right so the first one let's just go ahead and check this out.
Going to do STD c out to do a nova STD non Allen here was gonna just do five w equals six, five doesn't equal six obviously this is for some reason to overload the they will put in brackets, okay so if we just run this it put zero aka false but if we change this to a five and then it puts it to a one or print out one simply because five equal five The next one we're going to be looking at is we're just copy and paste it. So it's a lot easier to implement and quicker. So undo is five not equal to five added is equal to five, it will return zero if we if we put not equal to 98. It returns one. Now we're going to the less than, is five less than five. No, it is not if five less than nine.
Yes, it is at endpoints return one. Now is five greater than five? No, it is not created equal to five. But if we just change this to a two, you could even be a minus, minus nine. And it still come up with one because obviously five is greater than minus nine is five, less than or equal to five and everyone it comes up one because for It isn't less than five, but it is equal to, that's what this operator checks. And the next thing we're going to check is, is it greater than or equal to?
One cuz those not greater than is equal to just one quick thing to note before we go is this little operator here, even though this one but mainly this one, it's a double equal, which is the comparison operator. And a single equal is the assignment operator. Just try not to get them confused because getting them confused chemical issue. Obviously, if you put a double equal instead of a single equals, you're just comparing value. And obviously, if you accidentally put a double equal, I mean, you actually put a single equal instead of double equal instead of comparing two values or were both lucky be assigning a value and sometimes it will just come we'll just call up as true because it It says yeah, the operation was true it will find even though the actual if statement should have been false or false, but we'll look into stuff like this statements later on.
If you have any questions feel free to message us support Asana systems color UK the email will be in the description you can comment on this video just directly messages for you, or the recording for source code will also be in the description. The next tutorial we'll look at logical operators and thanks for watching and I hope you have a nice day.