 Welcome to this session of the course on computer programming. In this session, we shall move closer towards the programming language C++. You will recall that last time we had seen how to write a program for Mr. Dumbo and we also saw how Dumbo executes a program. I hope the animation which displayed how the program execution proceeds was useful to you. In this session, we will see the possible problems when Dumbo executes an input or an output operation interactively that is when it has to collect values from us and give values to us. We will also determine a solution to this problem. In the process, we will find that the program that we so construct for Dumbo actually looks closer and closer to an actual C++ program. Indeed, we will see how conceptually the model that we have built of a computer in the form of Mr. Dumbo is actually very similar to the actual C++ programming language. Observe that when Mr. Dumbo has to do interactive input output, he will have to interact with us. We have to give input by using some device and we have to collect output by using some other device. What devices should we use? Just as we designed an artificial set of drawers for memory of Mr. Dumbo and designed a workbench, we could design something arbitrary. However, it makes sense to use a normal keyboard of a computer for supplying input values to Mr. Dumbo and a normal monitor of a computer on which Mr. Dumbo will display the output value. Makes imminent sense because we are familiar with both these devices. After all, you are all using these devices for learning this course. Assume then that an input operation will require that we type in a value on a keyboard and an output operation will cause Mr. Dumbo to bring a value and display it on the monitor. But there is a problem. Imagine that Mr. Dumbo is executing the instruction input and void. Let us see what happens. Here is Mr. Dumbo. He is executing the instruction input and void. He has brought his card and he is waiting on the other side of our computer screen. Notice that all that Dumbo is doing is internal to a computer. We cannot see. We on the other hand are sitting here with a keyboard and a terminal. We do not perhaps know that Mr. Dumbo is waiting. So, we may wait for something to happen. But as unless we type in some value, Mr. Dumbo cannot complete his execution of the instruction input and void. So, Dumbo will start. How long? Obviously, he will stand eternally if we refuse to feed in any value. This is obviously not a desirable situation. We would like some indication, preferably an indication to appear on our screen which suggests that Mr. Dumbo is waiting for some input value. Well, we then introduce another instruction. An instruction to output a message. For example, if we write output enter number of void, this is a string of words enclosed in double quotes. This is almost like an output instruction. But instead of outputting the value of a named location, we are asking Mr. Dumbo to output just this string as is. What Mr. Dumbo does is he actually brings that string to us and shows that string on the monitor. Now, when the string enclosed in the double quotes without the double quotes of course are shown out to us, then we know and suppose we write our input instruction after this. Very obviously, Dumbo will first show this output to us. We know now some input is expected and then we are ready to type a value in. In exactly the same fashion, we can use the same output instruction to make our output more meaningful. Namely, the final value of n students which Mr. Dumbo has to show us instead of asking Mr. Dumbo just to say output n students can actually output first a string like this, not enter number of void, but let us say total number of students in the class and then output that value. Here is a modified program for Mr. Dumbo. Read this very carefully. The first instruction is exactly same as it was. Use locations n boys n girls n students. It is a declarative statement. Next instruction is an output instruction. Output enter number of boys and then there is an input instruction input n boys. What is the meaning of this? We are asking Mr. Dumbo first to show us this string on our screen. This makes us ready to give an input value because the next instruction is input n boys and Dumbo is bound to come to us with his car waiting for the value. But because of this message that we have seen earlier, we give that value. Same thing is done with the collection of the value of number of girls. So, output something and then input n girls. Next we do the calculations. This is through the assignment operation that we have already seen. But after calculating the result value, we simply do not say output n students. Before that, we say output the total number of students is and then we put this output. You can guess that the input output interaction will be much better. Let us look at a video animation to see exactly how it happens. So, imagine that you are sitting on this keyboard and this is your screen and let us see what happens when Dumbo executes the modified program. The first instruction that Dumbo will execute is to output enter number of boys. Dumbo brings the string and throws it on our screen. We will now see enter number of boys on our screen. Then the Dumbo will come with his car to execute input n boys. But we are forewarned. So, now we can input the value 12, press return key. Dumbo will take this value 12, take it in his car and go back and store it in the location for n boys. Next he similarly brings another string. We say enter number of girls. He throws the string because of this output statement and we see enter number of girls. Again forewarned when the Dumbo comes to collect the input for n girls. We now have this message. So, we type the value let us say 28, press enter. Dumbo now collects the value 28, goes back with his car and deposits this value 28 in the location for n girls. After doing the computations towards the end, Dumbo will bring another string because this instruction, the total number of students is and this string will come here. Afterwards Dumbo will execute the instruction output n students and now the value 40 will come and now this 40 value will come after the string. Notice how beautiful the interaction now is. Before asking for this value Dumbo actually gives us this string. Please note Dumbo does not do this on his own. We have instructed Dumbo to first show us the string and then execute the input statement. We have instructed Dumbo next to show us this string by output and then execute an input statement for n girls. Again after doing the computations of n students, we have instructed Dumbo to print this string on our screen, the total number of students is and then give the output value 40. You will agree that with this simple mechanism, we have actually made Dumbo a very real computing device. As a matter of fact, the program that we have written to calculate the total number of students in a class given the number of boys and girls, that program uncannily looks very similar to an actual C plus plus program which we shall later learn to write for actual computer. Let us look at a C plus plus program. Here is a C plus plus program to find n students. There are of course major differences but let us just try to read and see what it says. Int, n boys, n girls, n students. We do not know what int is but do not we suspect that this is something like a declarative statement which tells C plus plus that we are going to use these three names. C out less less enter number of boys. C in greater greater n boys. Now while less less greater greater we do not know but C out at C in does distinctly ring a bell in our mind. This is probably an output statement. This is probably an input statement. In fact it is so. Here is another output statement and another input statement. Here is an assignment statement n students equal to n boys plus n girls semicolon. Wow, this looks exactly like our instruction for assignment given to Mr. Dumbo. Indeed C plus plus uses exactly the same notation. Here again is an output instruction and another output instruction to complete the job that we did by writing our program for Dumbo. There is another unknown thing called return zero. We do not know why somebody is returning zero and to whom it is being returned. However, we take it to mean that this is something special to C plus plus but observe that this entire program looks so similar conceptually to the program that we wrote for Mr. Dumbo. What it means is whatever we have studied in terms of the conceptual model in the form of Dumbo and his capabilities and in the form of writing instructions and writing programs for Mr. Dumbo is likely to be immediately useful for us to understand C plus plus programming. In summary we have understood how Dumbo can handle interactive input output. We have also learned what an actual computer program looks like. In fact, we notice that a C plus plus program does look familiar now. Well, with this preparation we are now ready to jump into C plus plus. So, next we shall see C plus plus. Thank you.