 So, you are all familiar with the names that we use in C++, they are used to designate objects which we fondly call variables. Later on when we discuss the object oriented concepts, we will understand what is the difference between an object and a variable. But as far as we are concerned, these are all variables. Each variable has a certain type and the fact that it is called a variable means its value associated value can change at any point in time. So typically for our programming so far, we have used variables and arrays which are declared with a name. The name is of our choice. We can also declare constants which appear in our C++ programs. These are also objects of a certain type. Names is any sequence of characters which will include digits 0 to 9, small letters a to z, big letters a to z, capital letters a to z and underscore. The name cannot begin with a digit. It can begin with any other character. However, you are advised while the name can start with any letters from a to z, a to z and underscore, you should avoid using underscore at the beginning. Traditionally by convention, names beginning with underscore are used by systems of fair people and name starting with double underscore are used specifically as internal names for compilers, operating system writers and so on. For application programs that we write, no name should ever begin with an underscore. It doesn't make sense any names have to be meaningful. They can be any length, but the compilers might limit the length. So do not have to particularly test the patience of the compiler by writing a 90 character or a 100 character name. In fact, please understand that if you write a very long name and that name appears in some 100 assignments and ifs and so on, it's your life which is going to be miserable typing. On the other hand, to save typing efforts, you use names like A, B, C and all. The program won't be meaningful to the other human readers. So you have to make a balance. Meaningful names are important. For example, average marks would be a meaningful name. But if you just say X, Y, Z, people would not understand what these. Now the type associated with the name is an extremely important concept. You are already familiar with the basic types, care, end, float, double, void is also a type. We say that the name, which is described as a void, will never have any value associated. Bool is a Boolean value. The way the types characterize a particular variable is the way in which internally a value is represented and handled. The type of every name must be declared before its first use. That's the bottom line. As a good programming practice, there is no harm if you declare all variables and arrays that you are ever going to use in your program at the beginning itself. In fact, the professional programmers usually will not only describe variables and arrays, they'll give in-line comments in the program saying what this variable stands for, what this variable is used for, what will that array contain, etc., etc., making the program more readable and understandable. The format of associating type is, you just say type name followed by the variable name. So int midsem marks is a valid declaration, care, yes, no response. Int histogram 256. What is this? It's an array of 256 elements. Each element of this array has the type in. That means it can handle an integer value. Please note that the variables that you declare like midsem marks, yes, no response, any number of other variables, even if you declare them consecutively, there is no guarantee that compiler will keep them in consecutive memory locations inside its map. It is free to provide storage wherever it teams it fit. However, if you declare an array or a matrix, all elements of the array are guaranteed to be allocated consecutive locations. You will later on see when we use pointers and all, why this is important, because the consecutive locations can be accessed randomly and yet exactly, we shall see that later. So the compilers use declarations that we give to allocate memory. For example, int midsem marks will require four bytes, yes, no response will require one byte. What type of values will be stored in these? So what is the type of value that will be stored in midsem marks? Integer as in, integer itself has different flavors. So for example, there are qualifiers. So you have short int, unsigned int, long int, unsigned care. These are qualifiers for certain type and these qualifiers are used further by the compiler to decide what will be the value representation inside and what will be the storage allocated. Now internal representation of values, we spent a considerable amount of time in noting how the values are internally represented. Inside the computer, the memory always consists of a sequence of bits, zeros and ones, exactly like a series of lamps that you have kept inside a memory location. A lamp is either on or off. And if you consider all the combinations of a series of let's say eight lamps, then each one can be on or off and together they represent a byte or eight bits. That's exactly how internally memory is, although it is made of semiconductor elements these days. Now given that a sequence of bits can only hold a sequence of zeros and ones, any value that you wish to represent internally has to be converted into a binary form. Any value that you want to see on the output from your program, internally it is converted in some binary format, but it must be converted into some kind of a readable decimal value, further converted into ASCII character course of those characters which constitute that value and then thrown out on your terminal. Similarly when you type input, say for example you say C in marks and marks are set 25. Now you know internally that an int marks will actually store this 25 as an integer binary. Which binary is signed, unsigned or two's complement? Int is always a two's complement considered to be a signed value. So what is the 25's internal representation of two's complement? You can figure that out easily by converting decimal 25 into binary. That is how the value will reside inside that memory. But when you say C in marks, now you don't type 101010, you type what? Character 2 followed by character 5 followed by character enter, each one of which has an ASCII code. Please remember when you use C in statement and give input, what is going into the computer from your keyboard or sequence of ASCII codes corresponding to each letter that you type. Each key on the typewriter has a corresponding ASCII code, is that code which is going in? It is the CN which has the property of examining all these incoming ASCII codes and figuring out oh, the fellow means value 25, internally take the ASCII code of two, ASCII code of five, interpret that to be a value 25, convert it to binary and then store it inside. In exactly the same fashion, if you say C out marks, the excess location will contain a binary representation of 25 or 35 or whatever. But that value will have to be converted into decimal first, then converted into appropriate ASCII characters and those ASCII characters will be thrown out on your monitor. All that happens through CN and C out, what we are discussing is internal representation and the internal representation will be of all of different kinds, ok. Now please note that a location contains some bit pattern, but the same bit pattern can be interpreted completely differently depending upon what type of value your program has stored inside and C++ compiler has to be aware of that, so that appropriate circuits are energized when processing a floating point number or when rotating a processing a two's complement number or whatever, right. Externally, you represent numbers also in your program, so when you write 25 for example, this constant will be stored by C++ compiler somewhere in an appropriate form, which is appropriate as per the type of that value, so even constant values that you write have types, so 25, what type is this? Int, minus 73, int, 25.0, float, 2.1 e12, 1.76 e minus 13, float, 012, it's an octal number, no number will ordinarily start with zero, if a number starts with zero, it is treated as an octal number, C++ provides that facility for you to write an octal constant, of course it will be converted into a binary number internally and stored. What is this, 0x11, hexadecimal, alright. Now we have spent enormous amount of time in figuring out how to represent a decimal number in two's complement, in sine integer, for floating point, the mantissa part, the exponent part, etc., etc., and many of you had to struggle figuring that out, please appreciate the following, you are all professional students of IIT, science and engineering students and therefore you are expected to understand what happens internally, however, when you write programs, you don't have to worry about how the internal representation is going to happen, but what you have to worry about is what is the impact of that internal representation on the computations that you are carrying out, consider for example, if you multiply these two values, what will be the result of multiplication, 2.1 into 1.76 into 10 to the power 12 into 10 to the power minus 13, is that correct, so this will be a valid number represented inside the machine, now consider I add these two numbers, what will be the result, let us call this number x, let us call this number y, initially I have stated x is equal to 2.1 e12 and y is equal to 1.76 e minus 13 and I say see how, what value will I get, now ordinarily given the background of the discussion that we had, each one of you will start first translating into number of bits for mantisa, number of bits for exponent, etcetera, etcetera, etcetera, but that is the goal agree that C plus plus is destined to do, I need not do it as a programmer, but I must understand what is the consequence of such representation of mantisa and exponent and when the values are mathematically operated upon, like addition, subtraction, multiplication, division, what happens, you all agreed that if I multiply x and y, then multiplication would result in a reasonable number and that number can be reasonably accurately represented inside by a floating point value, I am asking you what happens if I add this, what will happen, value of r will be equal to value of x, is everybody clear on why he is saying that the value of r will be same as value of x, why, how will this addition be performed mathematically, forget the binary representation, the first number is actually 2 1 0 0 0 0 0 etcetera 0.0, the second number is actually point 0 0 0 0 0 0 sum 0 1 7 6, agree, 10 to the power 12 means so many 0s here 0.0, 10 to the power minus 13 means so many 0s after decimal point and sum value, now you add these, your addition will be 2 1 0 0 0 0 0 0 0 whatever point 0 0 0 0 0 0 1 7 6, such a number cannot be represented exactly in a floating point representation because your mantisa has limited precision, how many bits, 23 bits, they could have been 37 bits, they could have been 48 bits, you still not be able to represent so many digits, so please remember as far as we as programmers are concerned, our fundamental objective in life is to ensure that any computations that we perform, the result of those computations stay within the representable range of the numbers of a particular type, otherwise my program will not produce characteristics, it is ok if I am not able to convert something into binary, but it is not ok if I do not understand the implication of such binary representation, is that clear to you, so you should know for example that you will lose precision, the more interesting part should be what happens when I do not lose the entire number y, but I lose part of the procedure, so that will happen when for example the exponents are not same, but close and I have significant digits in both the numbers, when I add them I might get a number which has say 10 significant digits, but I cannot store all 10, so I might store may be 7, so the remaining 3 will just get chopped off, that is the implication of computations, what will happen for integers, you will have overflow, what will happen if you have operations such as a divided by b, the result is r and b is equal to 0, what happens, any idea, not very clear, that is the point we all missed, while we insisted that you should understand how numbers are represented internally, the purpose of that was to ensure that you all know how these numbers are represent, but all of us forgot the basic objective of reprinting these numbers, namely to do something with those numbers, to carry out numerical operations and what is most important is what happens when we carry out certain numerical work on these numbers, so what do you think will happen if I divide a by b and b is 0, it is infinity right, what will happen if a is 0 and b is also 0, what is 0 by 0, mathematically, sorry, undefined, it is called a NAND, not a number, not a number, infinity is called a huge value in C plus plus, in fact if at all you have a 0 division by 0, many compilers will not crib, but they will store in the result r, a special bit pattern which does not represent any floating point number at all, but it represents an infinity value, similarly if you ever have 0 by 0, instead of shouting, some compilers may store another unique pattern of bits, which will tell the compiler if you try to output it, it will not print a valid value, in fact many compilers will output actually the string NAN saying not a number, that is useful for you to know that the program has bombed, but it is not useful to know why the program has bombed and where it has bombed unless you take care while writing the program, is that understood, the implications of the binary representation is what needs to be understood by all of us, namely the capacity of numbers which can be represented, the input and output of data values I have already explained, C in use for collecting data, C out is used for giving data, later on we shall see some other mechanisms of collecting data from standard input file called STD in and producing data on standard output file called STD out, which is what C in and C out are connected, we have special functions called printf and scanf, which we will discuss when we discuss the character string processing, we also have special functions which can explicitly open files of data stored on your disk, read all that data and at the end of that they can close the files, they can write files on the disk and so on, we will discuss that in due course, but currently C in and C out are the two operators that we use and we must understand what they do, so what gets collected as input and what gets shown as output is always a set of ASCII values, so what we type in as I mentioned, we are typing in one key at a time when ASCII code is going, similarly what the computer is throwing as output is one character at a time, which is an ASCII code, if you see something coming on the new line is because the new line character ASCII code has been sent by the computer to your morning, however internally we all know that value representation is completely different, is binary float, two's complement, whatever mantis I exponent whatever, the job of this conversion is handled by C in and C out, okay, C in has some restriction, it expects any value that you given as a consecutive set of ASCII code, so for example if you type a name, the name cannot contain a space, C in ignores all leading space in between space, wide spaces they are called tap characters, new line characters, so the input has to be set of consecutive digits or characters, arithmetic operations and assignments, all of you are familiar with this, A is equal to B plus C in C plus plus is an assignment operation versus an equation in maths, I think that much is pretty clear, these are arithmetic operators, they have precedences and associativity and you use parenthesis to override the associative, so anybody has any doubt about what is A plus B star C plus D, what operation will be performed first, B star C or is it this or is it this, paka, no confusion, so in C plus plus star has higher precedence than plus, in fact star slash and modulo operator each has higher precedence than plus or minus, what happens, what is A plus B minus C plus D, is it this or this, so plus and minus have same precedence, so it will actually do left to right for associativity being left to right, it will first find out A plus B, then to the result from the result it will subtract C and to the result it will add D, this is the sequence in which operations will happen, this is quite often used to rearrange complex terms of your computations and an expression such that the expression result is still meaningful, otherwise if you do the calculation slightly differently then the result may be out of range, here is an example, I want to calculate 50 into 49 into 48 into 47 etcetera divided by let us say 43 into 42 into 41, will it be right to write it like this, what may happen is the compiler will just execute these from left to right and somewhere it might get into a problem of overflow, whereas if I rewrite this as 50 slash 43 star 49 slash 42 etcetera, of course if these are integers I am going to lose fractions, but the point being made is that you can actually judiciously reorder terms in an expression to ensure that the final result remains in the range, as mentioned star slash and modulo have the same precedence and the best practice whenever in doubt is to use brackets, because brackets or parenthesis always override any precedence that the operators may have, there is a result type of an arithmetic expression and this result type has a rule of thumb, the more expressive type is the type to which the final result will be converted, the more expressive generally means larger range of values are represented in that type, for example float a and int b, so if you say a star b the result will not be int, but the result will be float, because a is considered more expressive, so if you say a plus b a minus b a star b a slash b will all be float, but 2 star b is int, but 2.0 star b is float, please note that the constant 2 written this way and the constant 2.0 or the same constant 2 is written as 2.0 are two distinct constants as far as c plus plus is concerned, internally they will not be referring to a same location where number 2 is stored, one constant 2 will be stored as an integer internal representation, other constant 2.0 will be stored at some place with a floating point representation and whenever you multiply float with a int, you will get a result float, so if you have double a float b a int c, double is considered more expressive than float, float is more expressive than int, so if you say a plus b star c, b star c which actually multiplies a floating point number with an integer number will result in a float and a plus that float result will result in a double, common sense actually, but you have to be very careful in knowing these things and you have to be able to write your expressions properly. Now, we come to the notion of a function, you have already seen functions in greater details, but to understand that every computational task that we perform in c plus plus is performed through a function, in fact the main program that we write itself is a function which is invoked by the operating system. So, in code blocks for example, when you type a program and say build and run, when you say build the back end system is actually building, compiling that program and when you say run, the code blocks environment runs your program as if it is a function. Now, what are the characteristics of a function? First of all each function must have a name, each function is supposed to perform certain sub tasks. The main program itself is performing a main task as far as you are concerned, but for an operating system or the code blocks environment it is a sub task. So, every function has to have a name, same naming rules as variable, but additionally it can acceptional input parameters and it can return value. So, for example, input parameters have names and types, return value has a type and it permits parameterized computation. Here is an example of function that I would write. For example, I want to add two numbers a and b and to calculate the value c. I could have written c is equal to a plus b as we did here, but as you ask I might decide to write a function to add two numbers. Now, when I do that the choice of the name of the function is mine, the choice of the type of parameters that I pass is also mine and the choice of the return value is also mine. So, since I want to add two integer numbers and get an integer value I have defined this function as int add two ints and I have given two parameters int m, int m. Notice that inside a function the parameters each must have a type and the return value if at all the function returns a value must have a type. Now, when I invoke this function this is the main program which will be first executed. When I come here c is equal to add two ints a comma b, a and b values will be passed as a parameter. So, parameters parameterized computation is possible. This value a will be copied into m, this value b will be copied into n. I am internally declaring a variable r, I am calculating r is equal to m plus n and I am returning the value of r. This r is integer and that is what is the return. Actually, when you come back here add two points the name itself has been defined as an int type. So, it will be replaced the whole function called will be replaced by an integer value and that will be taken for subsequent completion. So, if I have a simple problem of q equal to a slash b we already already concluded that even if b is 0 it is ok the compilable somehow take care of it, but suppose I want to take care of it then I cannot write a statement. I want to write this statement q is equal to a slash b only b is not equal to 0. If b is equal to 0 I want to do something else give gullies or whatever and come out. Now, I cannot do that if I just have the sequential execution of statements as the only control possible in a c plus plus program and that is the reason why I have a conditional execution. So, if whenever I have question what if this is so or what if this is not so then I have to use some instructions which are different from the conventional instruction. So, in this case for example do you really want to divide a by b b is 0 we need special provision to control the flow of execution and what is that crystal provision we want to selectively execute some instructions if sub condition is true or some other instructions if that condition is not and this is implemented through a conditional execution statement for example, in this case b is 0 if else is the way in which we implement the statement is written as if condition statement one else statement two notice the two semicolon after this you write the next statement. So, what is important to understand is if condition is true then statement one is executed and then you go to the next step if condition is false statement two is executed then you go to the next step in either case you will execute only one of the two statements but never both and the way you write them is use indentation use brasses they mention the statement can also appear without an accompanying yes what does this mean if condition is true do this statement one and then go to the next step if condition is false simply go to the next statement don't execute if several actions are to be conducted on the true path and the false path as you know then I should combine all of them and group them is a pair of brasses here is an example if a greater than b I want to calculate p is equal to a minus b q is equal to a by b on the other hand if a is not greater than b I want to calculate p equal to a plus b and q equal to a star b some arbitrary calculation in either case I want to come out and calculate s as 25 into p by q and output s now this is the logic I want to implement the only way I implement it is I say if a is greater than b do this set of problem set of statement and after doing this get out here now this get out here is very very important to understand although all these statements are written one after another if this condition is true only these statements will be executed and you are explicitly forced by C plus close compiler to go on the other hand if this condition is false you will not execute these statements at all will come directly to the else path execute those statements and then of course fall through to the subsequent because lot of mistakes are made particularly when I use nesting of it first some preliminaries comparison operators are often used to write condition how do you write the comparison operators less than less than equal to greater than greater than equal to not not equal to is exclamation mark equal comparison results in a Boolean value to our faults okay now if the value is true if condition is set to be holding and you execute the statements written after the the value is false you go to the else path you can always write multiple conditions all of you are familiar with logic operators or and not notice the peculiar way in which they are written logical end as written as and and two ampersands two vertical bars and a single exclamation you can nest ifs so if something do this this this again if something do this this this if something do this this else this else that else that but always note that if and else are always paired and matched so one else wherever it appears will be matched with the immediately presiding if unless the if statement has terminated without an else there is a ladder if else if a kind of construct which permit you to say if this conditions so then do this else if this condition do this else if this condition do this else if this condition do this and then you write the next under what circumstances you will execute the next statement. If this condition is true you will just execute this part and come out here if this conditioning not true you go and examine the second condition as this is true then you execute only this state and then come out. So, basically where you get out is also clearly state. There is a stitch statement. This is a special kind of f, it is a composite f, where based on the value of a expression, you can actually associate different actions for different value. So, the value is 1, you do this, value is 2, you do this, value is 7, you do this, value is 22, you do something else. You can stipulate that using the stitch statement. Here is an example of switching. If x is 1, then I want to output x is 1. Else, if x is 2, I want to output x is 2. If x is 3, 4, 5, 27, minus 31, whatever, I want to output, value of x is unknown. This is my logic. Now, I can implement this logic here. This program is perfectly correct and it will work. Notice that it uses an else if ladder. If else if, else this. On the other hand, if I use the stitch statement, what do I want to do? It is like if x is 1, I want to go this way, x is 2, I want to go this way, x is 3, I want to go this way, x is something else, I want to go this way. But after doing wherever I go, I want to skip everything else, that jamela and get out to the next step. This is how the program would then be written. A switch statement which says switch on the basis of x. x must have a value. If the value is 1, then you say case 1 do this, case 2 do this, case 3 or case 4 or case 5 known as default do all of this. Notice a peculiar statement here called break. This break statement is required to break out of the switch. Without the break, there will be a fall through. That means if I do not write this break and suppose x is 1, it will come to case 1 all right. It will execute c out x is 1, but then it will fall through here. This is not a protected statement like if else. In the if statement if you have brasses, you do not fall through. You go to the next statement after completing the if part or you go to the else part. In switch, unless you write a break, you sort of fall through. So, it is possible to execute all statements in that sequence, although the value of x is only 1. Remember that when you implement anything using switch. In the concluding part of this recap, we will relook at an example which Professor Supratik had created and that is part of the video. All of you would have seen that video. You might have answered some quizzes, but this is a quick recap of that example just to explain further how the solution was constructed in that example. This is an intelligent fortune program. All of you are familiar with fortunes. There are some hotels, particularly Chinese hotels. When you finish your food and go out, they give you a cookie and when you open the cookie inside, there is a limelight, toffee or something and then there is a small piece of paper which says you will have a fantastic day today or whatever, whatever. I have never seen a bad fortune, but these are the sort of fortunes that you come across. Now, you want to write a program which based on the time of the day will give you a fortune. So, in the morning you will get one fortune, afternoon you will get another fortune, evening you will get another fortune, let us say. So, that is a program that you are writing. Now, first of all the input given to this program is in terms of date and time. The date is given as a single number, DDMMYYYY. That means the number that you give is an integer number. It will have so many digits, but these digits must be such that the first two digits represent day, the next two digits represent month and the last four digits represent a year. Similarly, the time is given as another number, HHMM. First two digits represent hour, last two digits represent minutes. How do you write hours and minutes in this format? Suppose it is morning 8 o'clock versus evening 8 o'clock, simple. You use a 24 hour format. So, evening 8 o'clock is written as 2 0 0 0. That is the way in which the two values are input. Your job is, first check if input is valid. If it is valid, say good morning, good afternoon or good evening depending upon time of the day. If date is invalid, you throw out the program. If time is invalid, you throw out the output as error, but if both are valid, you first do this. Then output, one of the three predetermined fortune messages. So, three strings are given. These three strings make a few, I mean any three messages. You will have a fantastic day. You will get lot of money or you will lose a friend or anything, good, bad, whatever. Now, you have to print those predetermined strings. So, consider the first number, 12, 13, 1948 and second number, 2 0 1 5. Is there anything wrong with the second number? No. It represents 8.15 p.m. The first number, the third and fourth digit, which should represent month, represent a wrong month. So, obviously, it is an invalid input. The second pair of numbers is a valid input. What will you do to check whether the numbers are valid or not? You will have to, obviously, extract year, extract month, extract day, extract hour, extract minutes and individually check for their validity. So, this is the flow chart for checking the validity of date, for example. You read input, calculate individual components, DD, MM and YYYYY. Now, check if the date is valid. How will you check if the date is valid? If date is greater than or equal to 1 but less than or equal to 31, if month greater than or equal to 1 but less than or equal to 12, etcetera, etcetera. You will have to put those conditions. If those conditions are true, you go further. By the way, this is a very interesting notation in the flow chart. You use a solid circle and write some name. It means that in your page where you are writing flow chart, there is no space. This is a connector. Some other subsequent page, you will find that connector with this title, valid date input. Now, from there onwards, the flow chart will be written in the second page. In professional programs, the flow charts could easily be 100 pages big and you would still be able, you should still be able to understand which page connects to what and so on. So, this is the sort of symbolism that is. On the other hand, if date is invalid, you just say bad date input and return control back to the call. So, this code is more exemplified where you test if the calendar date is between this, calendar month is between this, calendar year is between this. Here cannot be greater than the current date or current year. But what about the date? Would the date be valid? For example, in the month of February. So, you can extend this validity check to a variety of levels. For example, the way the program is currently implemented, even 31 February 1967 will be a valid date. But this is an example of how you do the validation and in that example, this is the broad validation that has been performed. So, if this is so, you do this, otherwise output bad input and so on. This is the program. So, very simple. I declare several variables, date, time, calendar year, calendar date and time, calendar date, calendar time. So, please note I have input numbers which I am getting which are composite number and I must declare variables for components which I am going to extract. There is another variable called hash. We shall see its usage because the switch statement is used to generate the fortune message for which hash is used. Hash is not like in hash brown or something. Hash is a technical word which means a mapping from a set of numbers to typically a smaller subset of numbers. So, hash is used because your date and time or something is mapped onto a single digit one, two or three. We shall see that later. So, give date. So, you get date and time as inputs. Two numbers are collected here. Here is an example of date is this and time is this. Calendar year is calculated by dividing date by ten thousand and taking the modular reminder. You agree that this will give you the calendar year properly? The last four digits, last four digits. So, here is an example. If the date is given as this and time is given as this, then this will be equal to two zero one four. If you just divide date by ten thousand, then the number that you get is date and month which is two to zero seven. So, actually removed the last four digits and you have written only two to zero seven which is DD and ML. Now, you again do a modular hundred here to extract what the calendar month and then you take a calendar date by dividing by hundred. Now, this logic can be implemented in different ways by you, but essentially a clever use of modulo and division operator and storing intermediate results somewhere if you want when easily lead you to this. Now, this is the validation. So, complex condition is written. If calendar date is greater than thirty one or calendar date is less than one. So, you can check the complex condition. Now, as an exercise, I would like you to do the following. I would like you to expand this condition and write more conditions there including and or not any complex conditions, but ensure that the February date is correctly validated. That means you have to check whether the year is a leap year or not. Then check if it is a leap year the February date should be twenty nine. It is valid. Otherwise, twenty eight is valid. You will have to use that somewhere else that program itself will be complex and that part of the program cannot be easily fitted into the single condition that is written inside this if state. You might want to do it separately. On the other hand, if you are brave heart, you might write all the conditions inside that and the if will become like Hanuman Kapuksha about two page, three page if C++ compiler will understand it, but ordinary mortars like me will not be able to understand. So, notice what we do if this is invalid, you just say bad date input return minus one. So, here is an example of what you are asking because I have no sense in continuing the program execution. I am returning and I am showing a courtesy to tell the operating system that look I my program did not execute properly. Actually much later in the course when you do your projection so on and when in your projects which are like professional program even if something goes wrong, the operating system is supposed to be informed correctly and operating system may be required to execute some other program. It is possible for example, in a larger data processing setup such as J e data processing or gate data processing. For example, there are the sequence of steps which are executed. First do the data validation then prepare this list according to this ascending order. So, lot of files are processed and so on. One program executes and come back. Suppose one program says arrange this in sorted order and next program says print the final result. Now you will agree that the final result should not be printed if the original list was not sorted properly, but these two are independent programs. This is where you can actually write script for the operating system through which you execute all of these programs. The script which is typically called a shell script in a Unix operating system will say execute program 1 to sort. That is the second script which would have ordinarily said execute printing program will not directly says. It will have an if statement in the shell script which will say if the status returned by the previous program was not 0 then ask operator to do something again otherwise execute. So, just as you write programs in C++ it is possible to write command scripts for the operating system which will use this kind of status code. So, I hope that is clear now why I would make a provision for this. In fact, very often these scripts will not be written by someone else, but by the same group which is developing the application and that script will also be considered part of the same application package. When you run the package, the package will run properly independent of errors etcetera. Here is a flowchart for taking, checking validity of time. Very simple. You compute hour and minute from the time. If hour is less than 23 and minute is less than 59, but greater than equal to 0 you say valid time input to another connector. You go to this connector in your flowchart. Else again output bad time and return back. So, here is a program. Suppose time is 1345. For example, hour is given by time by 100, simple 1345 by 100 is 13, minute is given by time modulo 100, the last to be. So, you see a simple use of division and modulo operations and combinations can permit you to extract any digits from a longer number and you check this. If so, see out bad output and return minus one. Otherwise, the further code will come. What is the further code? You have to print greeting, whether it is morning or afternoon or evening. You want to say good morning, good afternoon, good evening. So, notice how easily it is done. If it is morning hours between 6 and 12, you say output good morning. Else, if the hours are greater than equal to 12, but less than 18, you say good afternoon. And else you say good evening. When Professor Supratik was writing this program, one of the puritans in my group commented that if it is exactly 12 o'clock you never say good afternoon. You say good noon, sir. So, our logic was by the time you figure out it is exactly 12 o'clock, it will at least be 1 millisecond past 12 and therefore, good afternoon is okay. But whatever, I digress. So, is this clear? Now, this is implemented using a nested if and you can use the nested if to any level that you want. Please note that if the hour is actually between 6 and 12, only this statement will be executed and you will come out directly here. The else part will be completely skipped. That is what is most important to remember in a nested if or in fact in any here is the printing of fortune messages hash. You remember we said hash variable. Now, the hash variable is used to map the data arbitrarily to one of the three possible value. So, what is being done is then time is added together. It is as good as generating a random number you will agree because you do not know what date is, you do not know what time is. Randomly then that number is reduced to a modulo 3 1. So, you will get either 0, 1 or 2. That means no matter which date or which time you go to the restaurant for eating food, whenever you come out, you will get one of these three messages. Case 0, output time and tide wait for none. Then there is a break. So, if case 0 is true that means date plus time modulo 3 results in a value 0, this part is executed and you break. You come out here completely after the first break. If case is 1, then you output that and again break. If it is neither 0 nor 1, this will execute where there is a will, there is a way. Please note that if my computation of hash said hash is equal to date plus time modulo 27 arbitrarily. But this program will still work correctly except that when the modulo remainder is 0 or 1, it will print the first two and otherwise all other cases it will print this. If you have any doubt whatsoever or any question in your mind, how does control flow after? Continuous statement. Continuous statement relates to the iteration, but effectively continuous statement goes back to the beginning of the loop again. Can a function return more than one value? A function can never return more than one value explicitly through the return mechanism and that is because for every name which is used for variable or function, there can only be one value associated. However, if you are passing parameters by reference, then indirectly you can get values back from the function, but directly a function will always return only a single value. Thank you.