Yeah.
This is the start of a new section in the section you'll be learning about conditional statements.
We learn what our conditional statement.
What are the ways of writing them and will use them in various programs.
So we'll will see a lot of examples up on conditional statements.
So let us start with the conditional statement.
What is a conditional statement.
see in daily life we come across conditional processing at various places.
For example if you're logging on any website then you have to give your user I.D. and password.
If it is a valid then you are allowed to enter in.
Otherwise you have not allowed.
So if-else second one for example if suppose there is a sale going on in any shop then if you make a bill
of some amount let us say thousand bucks then you will get a discount.
Otherwise no discount.
So if Bill is more 1000 then you'll get a discount.
Otherwise no discount.
So normal Billing will be done.
If you got marks that are passing marks that is greater than this much then you are pass.
Otherwise you are fail so like this there are many places where we use is and else conditional statement.
So the same thing in computation views condition statement.
So let us see how to write a conditional statement in C++ and how they work.
See this is a skeleton of C++ conditional statement if and this is the condition.
And this is block of if flower bracket.
Else block of else, if this condition given here.
If it is true then this block will be executed, if it is a false then this block will be executed.
So depending on the result of the condition if block is executed or else block is executed.
how to write condition we will see afterwards now the same thing.
The flow off of this one is shown here using a piece of flowchart right so flowchart is here like starting
and ending point leave it.
Only the part that is dealing with.
If a conditional statement has shown here.
This is used for checking the condition if the condition is true then this block of statements will
be executed.
Then it will continue further if the condition is false then it will branch into this direction and
it will execute this block and then continue further.
So the rest of the processing is common.
This is a conditional if true this one else false that one, so this showing the flow off control in case
of if and else. so this is the syntax of conditional statement and here writing if and then else, else is optional.
...
If you want to write else write it or other wise you can write if
If also. else nothing
So this is optional.
Now
Next thing we will learn what is this true and false.
Then after that I'll show you condition.
True and False.
see In C++ programming false means zero false means zero and true any other value is true.
So usually we say that one means true actually not just one any other number any other number numeric
right, integer type not floating point integer type.
Any other value is treated as true only it will check it for the zero and false otherwise true.
So it means instead of one if I write ten then also it is true minus 10.
Then also true minus 2.
Then also true what is the no. you take it is true.
So even you can write true and false like this are also you can use 0 and 1 in C++.
Now next thing we will learn how to write on this condition ambitions are written using a relational
operate does relational operators.
So what are relational operators.
Less than less than equal to greater than greater than equal to equal to.
So for equal to we have this symbol double assignments symbol and not exclamation equal to not
equal to.
These are relational operators.
We write conditional statements using relational operators and also logical operators so logical operators.
I would not show them now.
I will cover them in another video. now what this relational operator are?
These are used for comparing the values on either side.
See for example if I write a less than B suppose the value of a is 10 and the value of b is 15 then
what will be the result of this.
A less than B yes a is less than b so it is true.
So this gives the result true or false.
So it gives actually true or false means 1 or 0 it will not give any other number but it gives one or
zero. all these operators gives the result
Either true or false, right see,
Suppose I have a as 15 and b as 15 if I write it as a is equals to B then what is the result.
The result is true.
And if I say a is not equal to B then what is the result.
Actually they are equal so the result is false means.
This is one and this is zero.
If I say it a is less than or equal to B if it is not less but it is equal so the result is true.
So this is how it gives the result.
So remember the important point the relational operators give their result either in true or false that
is 1 or 0 , 0 or 1.
More about this how to use them we will write down the example programs and we will learn more about this
one.
So this video was just the introduction to conditional statements.
So the next video we will write on the program using this conditional statement and relational operators.