1 00:00:00,060 --> 00:00:06,070 Forecasts in C++ expansions in C++, we are going to discuss in this lecture. 2 00:00:06,090 --> 00:00:09,000 So without further ado, let's start the session. 3 00:00:10,140 --> 00:00:17,400 So first of all, I'm explaining you some basics about the model and programming concept. 4 00:00:18,090 --> 00:00:21,000 So what is actually meant by model and program? 5 00:00:21,690 --> 00:00:30,300 Suppose we do have a large program and we want to do like many actions in that particular program. 6 00:00:30,870 --> 00:00:36,930 Suppose it's an employee management system, and a lot of things can happen in an employee management 7 00:00:36,930 --> 00:00:42,360 system, like adding the employee, leaving the employee, updating their salary information, right? 8 00:00:42,840 --> 00:00:52,140 So these kinds of things can be done as a large single program without like having any kind of modularity 9 00:00:52,140 --> 00:00:59,490 in that, which means that if we construct a program in such a way that everything is done step by step 10 00:00:59,850 --> 00:01:05,190 without any action, it is very difficult to manage such kind of programs. 11 00:01:06,060 --> 00:01:14,670 So this cost bringing up a new programming approach, and that programming approach is far more tailored 12 00:01:14,670 --> 00:01:15,210 program. 13 00:01:16,200 --> 00:01:19,620 So what is the basic idea of more like program? 14 00:01:19,770 --> 00:01:24,960 So that's what we are going to see in the first section of this lecture. 15 00:01:26,250 --> 00:01:34,020 So in case of model, our program, a large program, we are dividing into small sub programs. 16 00:01:34,320 --> 00:01:41,670 And if we want to solve that particular large problem we are facing or we are trying to address using 17 00:01:41,670 --> 00:01:42,420 our program. 18 00:01:42,810 --> 00:01:51,570 We are trying to create smaller units of that particular program and try to solve that problem individually 19 00:01:52,920 --> 00:01:56,730 by solving each and every small units. 20 00:01:57,540 --> 00:02:05,220 So what we are doing, we are dividing a larger program into independent modules and in these units 21 00:02:05,220 --> 00:02:09,210 are completely independent of each other so that they can function independently. 22 00:02:10,050 --> 00:02:14,150 So this concept is quite modular programming. 23 00:02:16,030 --> 00:02:21,580 Now, why does that advantage of more lap programming that is an important topic you should be aware 24 00:02:21,580 --> 00:02:21,790 of. 25 00:02:22,750 --> 00:02:23,620 First of all. 26 00:02:25,470 --> 00:02:33,330 In C++, it's a great programming language which supports modular programming. 27 00:02:34,310 --> 00:02:41,090 And by supporting the programming model, that programming approach as C++ program can be. 28 00:02:42,290 --> 00:02:50,240 Smaller compared to programs in other programming language like Boscalid, Fortran, et cetera, which 29 00:02:50,240 --> 00:02:52,700 do not have this much more clarity. 30 00:02:54,110 --> 00:03:01,180 Then another thing is like we can avoid duplicating the code supposed to be right, therefore, for 31 00:03:01,340 --> 00:03:07,670 doing something in C++ and without knowing that that guard is already there. 32 00:03:08,540 --> 00:03:14,690 If I'm rewriting it, it's like you dig in and again and in my program, then there will be a lot of 33 00:03:14,690 --> 00:03:16,930 duplication in my codes. 34 00:03:16,940 --> 00:03:17,210 Right? 35 00:03:17,720 --> 00:03:20,210 So that kind of duplication can be avoided. 36 00:03:21,140 --> 00:03:30,200 Then next thing is, if we have a modularity in our programming, that code can be reused again and 37 00:03:30,200 --> 00:03:30,500 again. 38 00:03:30,830 --> 00:03:35,450 So whenever if I want to, I have a modular approach card. 39 00:03:35,600 --> 00:03:37,360 Some it's a function. 40 00:03:37,640 --> 00:03:47,040 We will be calling the modularity in the name that is called function in a minute that we will be introducing. 41 00:03:47,070 --> 00:03:54,920 For now, you just imagine we have a section in a program which computes the sum of two or three numbers. 42 00:03:55,490 --> 00:04:04,820 And if I want to compute the sum of numbers, I don't want to write the code for executing something 43 00:04:04,820 --> 00:04:05,600 again and again. 44 00:04:06,050 --> 00:04:09,980 But instead, I was just call this function again and again. 45 00:04:10,430 --> 00:04:12,740 Then that will execute and I can do the same. 46 00:04:13,850 --> 00:04:23,810 So that's one advantage of using functions or more like programming approach, and these functions can 47 00:04:23,810 --> 00:04:25,460 be called repeatedly. 48 00:04:25,820 --> 00:04:34,570 So what we use to achieve modularity in C++ programming, actually that discard functions. 49 00:04:35,800 --> 00:04:41,470 So, Fonctionne, help us to get deep more, that'd be in a particular program. 50 00:04:42,790 --> 00:04:49,570 Then using a set of functions, we can be fired and set to functions for different, different users, 51 00:04:49,840 --> 00:04:56,830 and using these set of functions, we can create a library and these libraries can be reused to get 52 00:04:56,830 --> 00:05:00,310 the desired things that. 53 00:05:01,230 --> 00:05:05,730 OK, so let's dive in deep, then you will get more on this topic. 54 00:05:07,290 --> 00:05:11,640 So in C++ beside the box office function. 55 00:05:12,180 --> 00:05:19,440 So these things, when we are creating a C++ program using modularity approach, we will be using a 56 00:05:19,440 --> 00:05:21,750 lot of functions in the C++ program. 57 00:05:21,990 --> 00:05:28,800 And if we are creating a function, then these are the important things we have to use. 58 00:05:28,980 --> 00:05:37,170 So our function will be consisting of a function brought on by function, definition, function, gui, 59 00:05:37,770 --> 00:05:41,400 actual and formal arguments and a written statement. 60 00:05:41,520 --> 00:05:45,180 Now we are going to see each one of these in detail. 61 00:05:46,880 --> 00:05:52,070 So here I am, giving you an example for prototyping and functioning. 62 00:05:53,200 --> 00:05:59,560 So while I start writing in program after my hash includes statements and are. 63 00:06:01,280 --> 00:06:02,930 Ash, include had that fire. 64 00:06:04,490 --> 00:06:14,330 After that, I will be having a lot of leg declarations, right, lot of including including statements 65 00:06:14,540 --> 00:06:21,350 or pre-processed that actives in my program and along with that, if I'm creating a function, if I'm 66 00:06:21,350 --> 00:06:30,290 creating planning to create a function in my program, I need to make sure that I declare a prototype 67 00:06:30,620 --> 00:06:32,150 why I start the program. 68 00:06:33,390 --> 00:06:36,090 So our prototype will be mainly looking like this. 69 00:06:36,660 --> 00:06:39,360 It will be showing it better by. 70 00:06:42,030 --> 00:06:42,750 Return type. 71 00:06:44,190 --> 00:06:51,240 Then we'll be showing why does the name of the function benefit of showing that arguments inside the 72 00:06:51,240 --> 00:06:51,690 function? 73 00:06:51,720 --> 00:06:54,960 What are the animals that particular function can accept? 74 00:06:55,140 --> 00:06:57,420 And then it ends with that semicolon it. 75 00:06:58,530 --> 00:07:04,140 Suppose I am planning to create that function, which acts to an ambush. 76 00:07:05,240 --> 00:07:06,950 Began floating by numbers. 77 00:07:08,350 --> 00:07:15,910 Then, before making the clear definition of the function, I need to get the prototype of the function, 78 00:07:16,450 --> 00:07:23,320 I need to write a prototype of the function in the stack so that the prototype will say to the compiler 79 00:07:23,320 --> 00:07:30,430 that there would be a chance that this particular function will be introduced or this will be a function 80 00:07:30,430 --> 00:07:34,120 in the program, which will be actually having a return type of law. 81 00:07:34,420 --> 00:07:40,720 Actually, that is given by the function will be a floating point number and the name of the function 82 00:07:40,720 --> 00:07:45,130 is some, and it will accept two numbers to do the operation. 83 00:07:45,250 --> 00:07:51,880 It will be both will be floating point operations and one more optional thing is like why are you supplying 84 00:07:52,390 --> 00:07:53,560 the prototype? 85 00:07:53,740 --> 00:08:00,040 And you declare the argument list, like, what are the variables that function? 86 00:08:00,040 --> 00:08:09,490 Except you can either merely define its type, followed by a comma or another ways you can give that 87 00:08:09,610 --> 00:08:13,120 variable name which you are planning to use inside your function. 88 00:08:13,570 --> 00:08:19,690 This concept will be also be clear for you while we look into a samba program. 89 00:08:19,840 --> 00:08:22,660 So let's move to the next part of that function.