 This is Siddhas Kumar Uttke working as assistant professor in Department of Mechanical Engineering Walchen Institute of Technology Sholapur. Today we will be discussing on programs on C++, the second part. In the last video lecture, we had discussed about how to write a program using function definition within the class and how to write a program using function definition outside the class. So today we will be discussing some applications of that thing. Learning outcome. At the end of this session, students will be able to understand and write programs using basic concepts of object oriented programming. Now we will be just checking how to write a program to find the largest of two numbers using class. It includes a concept called nesting of member functions. So what do you mean by nesting? I think you have heard about nest, the bird nest, it consists of branches and also we have seen nested ifs in which one if else contains another one more if else and this comes on repeating based on the conditions until we achieve the target or the conditions whatever the given. So the same thing we will be calling a function within another function that is nesting of member functions. So in the last video lecture we had wrote a program, C++ program which includes the header files. The same thing will be applying to this program. It also includes the header file called hash include ioStream which means input output stream header file then using namespace std. It means namespace is used to increase the scope of the identifiers std stands for standard. Then I will be declaring a class with class name called set1. Then I will be opening the class bracket then I will say I will declare the two variables m comma n as I want two numbers of data type integer then public is the access specify m comma n are private member variables. So the default access specify is private. So public is the access specify for functions. Then I will say void input this is the member function declaration then void display it's a display is the function okay I'm declaring one more function to get the output on the screen then there's a that the last thing I want to find the largest of two numbers using the largest function the written type is integer. It will return some value then I'll be ending the class. Now I have to define this functions so while defining the functions outside the class I think we had to use the scope resolution operator in the last visual lecture this is the same thing will be repeated the written type of the largest is integer and it belongs to class called set1 scope resolution operator largest function. Then I'll say what is the largest function doing it's finding the largest of two numbers so I'll put a condition if m is greater than or equal to n then it will return value called m else return value n then I'll be ending this function then I'll be defining one more function called input it's written type is void it belongs to call a class called set1 scope resolution operator I'm defining the function outside the class. Then again I'll say input what is the input function doing it's getting the input values of m and n so I'm using the cout statement then afterwards that is the insertion operator what is insertion operator doing what if the text or the string is typed after this insertion operator will be automatically displayed on the screen then I'll be using scene that extraction operator m extraction operator n then the last thing is defining the display function it's written type is void it belongs to class called set1 scope resolution operator then I'll be using cout statement so the largest value is largest function I'm calling endel operator you can use slash n and endel based on the condition slash n can be used in the string that is within the double inverted commas endel can be used after the string you can't use slash n after the string as it will prop an error then after this the main function from where the actual execution of the program starts integer mean then I'll be looking in object set1 a it means a is an object created it's an instance of the class called set1 then I'll be calling the function input a dot input then afterwards a dot display function then return 0 I'll be ending it so when I say a dot input I'll put the values called 2 and 3 so 2 is greater than or equal to 3 is it true no it's a false condition it means 3 will be the output displayed on the screen finally now pause this video for a few seconds now try to write the above program using function definition inside the class we'll be checking on one more program that is write a c++ program to define a class employing having members employ ID employ name basic salary and functions except and display calculate DA that is 25% of basic salary HRA equal to 800 in cup tags equal to 15% of basic salary then display the pace slip using appropriate output format so what are the inputs or what are the data members that are the employee ID employee name basic salary what are the member functions except and display so for this again it starts with the header files that is the hash include IO stream input output stream then using namespace STD namespace for increasing the scope of the identifiers STD stands for the word standard then I have to clear it what is the class name class name is employee so I'll declare the class class employee then afterwards open the class then what are the data members employee ID employee ID basically it's in the form of data type integer it doesn't have a fractional part then afterwards character ename of 100 so maximum 100 characters can be first without space then afterwards float basic salary HRA DA income tax net salary basic salary HRA DA income tax net salary all the salaries will be in the form of floating point format it means it will have a fractional part it doesn't have a integer part then afterwards public is the access specified so this all the functions are accessed by only the member functions so this all the data members that is employee ID character ename float basic salary are accessed by the member functions so which are the member functions accessing it that is the accept details that I am defining this function what is accept details doing it's actually getting the input of the user then afterwards see out enter employee ID seen extraction operator EID then see out insertion operator enter employee name then seen extraction operator ename then afterwards see out enter basic salary so here I'm using again insertion operator so till this time insertion operator you can write either in the one format or in separate formats then seen extraction operator basic salary I'm calling this variables then HRA equal to 800 it's a constant value afterwards DA is equal to 0.25 into basic salary I'm defining the formulas income taxes 0.15 into basic salary then I'll calculate the net salary that is basic salary plus DA that is duty allowance plus HRA minus income tax then I'll be ending this function accept it is then again void display details in void display details it will display the word of the output on the screen so it has it should be in the this proper format see out I'll be ending this slash and I have used it's okay because I'm using it within a string double quotes then afterwards see out slash and again employee ID I'll be calling that particular variable then see out slash and employee name again double quote again I'm using the insertion operator ename then see out slash and basic salary again the insertion operator I'm calling that particular basic underscore salary then see out HRA same I am calling the variable see out DA I'm calling that particular variable see out insertion operator DA I'm calling again the variable see out slash and income tax I'm calling that particular variable I underscore tax see out afterwards I'm printing the final value so this is how I have ended the first member functions second member for this is how I have ended the second member function afterwards I'll be ending the class then I'll be using the main function from where the actual execution of program starts then afterwards employee E it means employees the class and is the object created so if I call E dot except underscore details so it will take the employee ID name basic salary all this where data will be inserted into that particular variables when I say E dot display underscore details it will calculate the values and display it on the screen then read the zero these are the following references thank you