 Hello friends, I am Nawal Yemul working as an assistant professor in mechanical department Walsh and Institute of Technology, Solapur. So in this video we are going to see decision making statements part 2. Learning outcome, at the end of this session student will be able to create decision making statements in a C++ program using different forms of nested if else and switch statement. Content of the video are decision making statements, first nested if else, second is switch statement. Decision making statements, C++ is a conditional statement which allows us to make a decision based upon the result of a condition. These statements are called decision making statements or conditional statements. First nested if else, the if else statement executes two different codes depending upon whether the text expression is true or false. Sometimes a choice has to be made from more than two possibilities. If there are more than two possibilities, the nested if else statements are used and it allows us to check for multiple text expressions and execute different codes for more than two conditions. So we will see the syntax of the nested if else statement if followed by the parenthesis bracket and Boolean expression 1. If the Boolean expression 1 is true, it executes the statement below if and if Boolean expression 2 condition is true, it executes the Boolean expression 2. So the flowchart of the nested if else statement is explained in detail. Start if the text expression number 1 is to be true then it goes to the text expression number 2. Then if the text expression is true here, so the condition becomes text expression number 1 is true and the text expression number is true. Then the statement 1 is executed in the same way. If the text expression number 1 is true and text expression number 2 is false, then it executes statement 2. If the text expression itself is false, then it executes statement 3. Then the program is stopped. This is a figure showing the flowchart of the nested if else statement. So we will see a small program to check an integer is positive, negative or zero using nested if else statement. So I will give you few seconds to think the logic of this program. So we will see the logic of the program here using nested if else statement. So I have used the code blocks to logic to crack the program. So first line itself is ash include iostream using namespace standard. So I have taken the integer int main and integer variable as number, cout enter an integer and the integer is stored in number. So I have used nested if else statement. If the number is greater than zero and if the text expression 1 that is number is greater than zero, the number entered is positive. Else if the number is entered as negative or the number is less than zero, then the output will be you entered a negative integer or else the cout you entered a zero. And lastly cout this line is always printed. So here if if else and else is used and this is the example of nested if else. So we will see the output of the program. So enter an integer, if I have entered a positive number five, you entered a positive integer five and this line is always printed. That line is in the statement which is after the loop that is always printed. So if the user enters a negative number, the output will be you entered a negative integer minus four and this line is always printed. So this is second condition statement that is switch statement. A switch statement allows a variable to be tested for equalities against the list of values. Each value is called a case and variable being switched on is checked for each case. So here the variable which we which enters by the user is checked by each and every case. So switch case statements are the substitute for long if statements that compare a variable to several integral values. So we will see a syntax for switch statement switch followed by the variable case one. If case one is correct or the case one which is given by the user is correct, then case one is executed and it breaks and then it skips the skips the curly brackets and prints the next line or if the case two is correct, it prints the code to a case two and then it breaks it comes out of the loop and then it checks the case number three. So in the same way case n it checks till case n and then lastly it is default and your code executes the code and break and then it comes out of the bracket and there the statement is printed. So we will see the flowchart of switch statement start text expression one if the text expression is true it prints the case one and if case one is true then the statement one is printed directly and it comes out of the loop and it breaks here. Same way if case one is false and case two is true it prints statement number two it breaks and then comes out of the loop. If case one and case two both are to be false then it prints case three and statement three is printed it breaks and then it comes to the last that is default and this statement n is always printed as we have seen in the syntax then the program is ended here. So we will see a small program showing different grades using switch statement. So here I have again used code blocks first line is ash include iostream using namespace standards int main I have started the program I have declared some variables like grade and see out enter your grade and that grade is stored in grade I have used the switch statements here switch in bracket grade without semicolon then I have used curly brackets so I have used four cases here case A to case D case A shows that the grade is excellent and case B shows as the output is very good and case C shows that you have passed and case D is better try again and default is you have invalid grade. Suppose if the user enters any grade rather than D then it shows the invalid grade so see out excellent then after excellent I have used break if case one is true then it comes it shows the output excellent then it comes out of the loop and your grade is printed always your grade A is printed for example so we will see the output of the program. So if enter the enter your grade if you entered B it shows very good your grade is B in the same way if the user enters the grade D better try again your grade is D so this is a simple program using switch statements so these are the references I have used