 You have this additional interesting peculiarity, character objects. Remember we saw ASCII symbols? Character objects are defined to hold such symbols. One byte storage is allocated to every care type. The declaration is you say care, sim, care, first underscore, later underscore, off underscore, name. Basically, all these variables independent of the name are capable of storing one value between 0 to 255, which is interpreted to be an ASCII code of that term. The character values, constant values, just as we write decimal values, fractional values, character values are written enclosed in single quotation mark. So, single code P, single code, single code star, single code. What is the third one? Single code, blank space, single code. There are many symbols which are not visible to us. After all, there are 256 ASCII values. Some symbols are visible to us, A to Z, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, plus, minus. Some symbols like space is not visible, tab is not visible, new line character is not visible. For them, C++ provides a notation. If we want to specify any one of these characters as a value, we can put a escape character backslash. So, apostrophe backslash t, apostrophe close, means it is a tab character. Apostrophe backslash n, apostrophe will mean a new line character. Remember, you saw that on the screen, when you edit a program, there are lines. So, first line, many times, the next statement does not continue. There it comes on the next line. You typically press enter button to go to the next line. What is inserted internally is a new line character, and that is shown by this. Suppose I want to put a single code itself as a character. How can I do that? If I wrote code, this is my code, and this is my closing code. They all have the same symbol basically. Now, inside if I write a code, is that adequate? No, because the first code followed by the second code, C++ will say your character is ended. Although there is nothing inside, it will assume that you are specifying what is known as a null character. There is actually a null character which actually has a value 0. It will represent that by value, and then it will come to this third apostrophe. It will say, who is this? Error, error, error. So, if I want to prescribe an apostrophe, then I will have to use a backslash apostrophe. Backslash merely means, interpret the next character that I type as a special character. How do I include a backslash itself? Backslash followed by backslash. Because backslash means something special. The next backslash is actually a special character. That is how you can reply. I can have care objects. So, I can declare care sim. And in my program I can say, sim is equal to P in single apostrophe. This is perfectly valid. What will be stored inside the location for sim will be the ASCII value of P. Do you remember the ASCII value of P? Nobody remembers. We last time we saw M and OP, whatever, whatever. Sorry? 112. 112. Sure? Okay. Let's write 112. Whatever. We don't know. But 112 will take it. Now, here is the beauty. C++ treats every character object as if it's a numerical integer value. Because it is actually. What is being stored in that one byte is an unsigned integer, 0 to 255. Consequently, C++ permits care objects to participate in numerical computations. You can add something to it, multiply it by somebody, whatever. Of course, multiplying the value of P by 27 will yield meaningless results. But something meaningful can be done. So, look at this. Care sim1, sim2. Sim1 is equal to M. Sorry, there is a mistake here. I have to say this, right? So, the symbol value for M has gone into symbol. What will be the value of sim2? He says R. Can you figure out why? We don't know what is the symbolic value of M. Assume some number. We know that symbolic values for all the valid symbols are given in increasing order. So, if M has some value, next value will be N, next value will be O, next value will be P, next value will be Q, next value will be M, N, O, P, Q, R. M plus 1, N, M plus 2, O, M plus 3, P, M plus 4, Q. So, somebody was calculating it so fast that he skipped one later. So, what should be the value here? We will actually use this feature later when we learn to handle character value for the time being. Just treat it as a different data type where this is permanent. We will just ignore this slide. It's a busy slide. It's not much time. I still want to come to the expression evaluation quickly. This is a slightly longer lecture. So, we ignore this slide. You can read it later. All of these will be put up on the model. The assignment operation. This is the most important computational operation and it is necessary that we understand it. Whenever we write M equal to something, that statement is said to be an assignment statement. The assignment statement has two sides across the equal to symbol. The equal to symbol is not the representative of equality. Equal to symbol is called assignment operator. It has a left-hand side and a right-hand side. The left-hand side must be a single name representing an object which will receive the assigned value. The right-hand side is usually any expression which is calculated and that results in a single value. So, the way the assignment operation works is the value on the right-hand side is evaluated. In the sample case, the value is minus 35, so that itself becomes the value. Now, this value is taken and is assigned to the location designated on the left-hand side. Since LHS says M, value of M now becomes minus 35. If M was earlier 28, 35, whatever, that value will be lost. This new value will come into being. The expression can contain multiple arithmetic operators. What are the arithmetic operators? You are familiar with minus plus star slash percent is a modulo operator. It gives remainder. So, for example, if I have something like 10 modulo 4, what will be the value? 2. Because 4, 2 is 8, 10 minus 8 is 2, the remainder is 2. There is a precedence rule, common sense. All of your familiar division multiplication happens before addition and subtraction. The modulo is at the same level. If in an expression there are operators, one after another, which are at the same precedence level, then they are executed left to right. Again, common sense evaluation, all the algebraic evaluation rules that you follow. If you don't like that precedence, if you want something else to be done first, then you include those operations in parenthesis. So, you can supersede the natural law of associativity and precedence. The general form of expression is this. Name is equal to expression. You understood? RHS is evaluated. Here is a sample example given. How will this expression be evaluated? What is the precedence? First do multiplication. So, first this will be evaluated. You will get a value what? 20. Then you say plus 3. This will be evaluated. What is the value? 23. Now this, once you have received this value, you will assign it to the left hand side. Simple rules, no confusion here. Suppose I write this statement. a star a equal to 16. There is a question asked yesterday. He says I want to actually put value 4 in a, but I want to tell c++ compiler the same thing in a different way. I want to say a star a is equal to 16. Naturally a is equal to 4. See all of you have gone into a mode of treating this as an equation. a square equal to 16. Therefore a can be either plus 4 or minus 4. All that is silly. No, the first thing that you must observe is that it is a completely meaningless invalid statement for c++. Because LHS, the left hand side has to be a single name. Single name because that designates the receiver of a final value. There has to be a single name. This entire statement is wrong. It is rubbish. c++ will throw this out. This is what I want you to understand. If you want to say assign value 4 to a, you have to say a equal to 4. You cannot assign a value to an expression. That is why I said you have to remember this equal to is not an equality symbol. Equal to is an assignment operation and the form of that operation is LHS is to be assigned the value of RHS. RHS can be an expression, but LHS has to be a single object location. It cannot be a constant value also. You cannot say 5 is equal to a. That is invalid. Left hand side is cannot be 5. It has to be a location which can receive a value. So LHS of an assignment statement is a receiver, single receiver. Get this? No confusion. Here is another example of assignment operation. How will this be evaluated? First the right hand side will be evaluated. So what will be done first? It will of course first take all the values which are available. 5 plus m is 5 multiplied by n is 4 divided by 2 minus 3. This is the expression now. Now it will calculate it as star and slash. Both at same priority. What is the first one? Left to right. First it will do this. You calculate this as 20. Next it will do 20 by 2. Calculate this as 10. Now it reduces to 5 plus 10 minus 3. Next it will do this. Calculate it as 15. And next it will do this. Calculate it as 12. 12 is the value of RHS. Now this value will go and sit inside the location for R. Is this clear? That is how expression sorry value. Another expression. We will not go through the values but I would like you to ponder over what will be done first. What are the high priority operators? Multiplication. How many multiplications are there? 1, 2, 3, 4, 5. We have said that if there are multiple operators at the same precedence the operation will be from left to right. So as far as this is concerned this will be done first. This will be followed by this. What about this operation? What about this operation? Here this will be done first and this will be done next. But please note that these components are separated by plus, minus, etc. Now here is a question. Whether 3.14159 multiplied by R will be calculated first or whether 2 multiplied by 3.14159 will be calculated first. You must understand the rule of C++ does not specify that among two distinct groups of operations which are separated by lower level precedence operators what should be the precedence of doing things here or there? Actually it depends on the C++ compiler. By and large the compiler will carry out even these things first, this and this but that is not necessary. Later on we shall see when we consider particularly operators such as plus, plus, j they get evaluated whenever they occur. It does not matter where they occur at the right hand side. This is not very meaningful. As far as we are concerned we will still apply left to right rule which is open. R-D-A-S-H is a name which represents some other memory location. That's all. Finally this is what you must remember. LHS must be an object to which a value can be assigned. Must underscore must. No choice. Operand types. This is the one possible confusion. If both operands of the same type result value is of the same type. Very fundamental rule quite confusing sometimes. If in my program I write 9.0 divided by 2.0, the result will be 4.5. If I write in my program 9 divided by 2, the result will not be 4.5 because 9 is an integer value, 2 is an integer value, the division that is carried out is an integer division, fraction is lost. Of course if the operands are of a different type, then what is done is before computation the lower operand is converted to higher level. Integer is converted to flow. So consequently if I wrote 9 divided by 2.0. Now one is floating point, one is integer. So it will convert 9 to floating point. Treat this as a floating point operation and calculate the correct value 4.0. I could also write this as 9.0 divided by 2 or I could also write this as 9.0 divided by 2.0. If I have in my program float x in N and somewhere in my program I said x divided by N is perfectly valid. X is float, N is in but because the mismatch is there N will be converted to floating point and the result will be a proper floating point. You have to remember this because sometimes there will be a gacha. Sir, what is the approximation? Meaning? Let us say if I have integer, I have a thread in the integer. So result in the integer but my division accurate is 4.9. So will it show me 5 or 4? 4.4. Next slide does that. There are the possible problems in the expression evaluation. While two values participating in an operation can individually be within stipulated range the result may not be in that range. In such a case an erroneous value will be reserved. Actually the word erroneous is not correct. An approximate value will be reserved which itself could be erroneous. Here are some quick examples. i is equal to minus 25, x is equal to 2.147. j is equal to 3.2. j is integer. What will happen? j will be 3. What if I said j is equal to 3.9. It will still be 3. So when a floating point value is converted to integer the fractional part is mercilessly chopped off. j is equal to 1.24 e30. What will come into j? Remember 1.24 e30 is actually an integer number. But that number is 12400000 till eternity. And poor fellow j is a 4 byte number. It can at most store a few of the zeros. Complete loss of processing. This should never be done. It's our problem. y is equal to 29. 29 is integer. y is float. It's converted to 0.29. y is equal to 1, 2, 3, 4, 5, 6, 7, 8, 9. Now integer is being converted to floating point. The floating point representation actually is 0.123456789 multiplied by e1. If I treat this as a floating point in my representation it will be 0.123456789 e9. However, the mantissa has more digits than what can be accommodated in a 32 bit number. Since we said 6, 7 digits are excluded. What the C++ compiler actually does is this type it is more generous. It will round off the last digit. So if it can store, for example, 6 digits of mantissa precision the actual number will be 0.1234567. It has 6, 7 rounds up to 7. So here is an expression. How do I write an expression? Yes, can you help me? Multiplied by there is nothing like x cube, x square, etc. available as an operator. So I have to multiply this expression. This is okay. Suppose I had this 1 upon x plus 1 plus 1 upon something, something. It is possible that you start writing expression which will have bracket here and bracket here and bracket here. Many times in algebraic expressions you do that, right? Larger bracket means towards the end. Unfortunately, the machine does not have these larger and smaller brackets. So they have to be all written like this The entire assignment operation itself is treated as an expression. This is another googly of C plus plus. So when I say m is equal to n is equal to 25 is a valid statement in C plus plus. What it means is m is equal to in bracket n is equal to 25. Now this is a valid assignment statement. When it is executed 25 value is assigned to n. Apart from assigning the value 25 to n C plus plus treats that this entire expression also has a value 25. So the same 25 value can go into n. Consequently, if I have declared int m and p and if I want to initialize all of them to a value 10 then I cannot do that in the declaration easily. I will have to say int m equal to 10 int n equal to 10, etc. I can accomplish that more easily. This is just a squiggle and an aberration. Not a very important point. I don't encourage you to use such fancy stuff. Object on LHS may appear in an expression on RHS. This is perhaps the most important point. When I say n is equal to 3 star m plus 2 star n it is a valid statement. Assume that n has some value. Let us say n currently has a value 5 before I come to this expression at all. Now imagine what will happen? Let us say m has a value 3. So what will C plus plus 2? It will replace the values here. It will say I have to calculate 3 multiplied by 3 plus 2 multiplied by 5. In this I have this to be done first 9 plus 2 multiplied by 5. Then I have to do this next which means 9 plus 10. Then I have to do this and I will get 9. This is the value of the expression. Now it will look at the left hand side. So please understand if the variable object appearing on the left hand side also appears on the right hand side there is no dilemma. Because C plus plus compiler to begin with does not look at all at the left hand side. It doesn't care what location is specified. Looks at the right hand side, substitutes values calculate the final value. Now it looks at the left hand side. Left hand side happens to be n. So it will take the value 19 move this value 5 and put 19. This is often used as an increment operator. For example I can say m is equal to m plus 1. So it means before the execution of this statement suppose m was 25 after this it will become 26. This is used in many kind of counting algorithms which we will use later. So there should be no confusion. Always remember we are not talking about a equation. There is a right hand side which says m plus 1. It is calculated some value comes that becomes the new value of it. Is it okay? Fine. We will stop here. I have several other slides. I will just take this slide. Float x, y, avogadro. You all know avogadro number at least? You agree that it is 6.023e23? No. Yes? Fine. So now x is equal to y minus 8.6597 plus avogadro. How will it calculate? It will calculate y minus 8.657. What value you will get? Complicated. Some value. Yes? No one knows. Minus? Any one person please? If you are doing it mentally it is not a good idea. Minus 1.31. So I have got minus 1.3134. To this I want to add a value which is 6.023000. Till I get bored I keep counting 0 something like that. What will be the final value now? If I strictly do this subtraction the value should be 6.022999 again till I get bored and some values at the end which will be 6.6868. This is the correct value. I call this an accountant's value. But an engineer and scientist value is not this. What will happen in C++? It will say you have so many so much of precision I can't store all of this. I will store it in my 6 or 7 digits of precision. And since it's a fractional number I mean floating point number I will convert it appropriately. So I will represent 6.023E20. So Avogadro plus something Avogadro minus something is equal to Avogadro or E20. Well this is easier. Follow this? Okay we will stop here now. Thank you.