Welcome back.
So basically for the rest of our application, you already know everything that you need to know in
order to build it to a degree.
Okay.
You have not seen how to use arithmetic operators yet, but I assume you can use a plus by yourself.
So what I would really recommend is that you pause the video now and you try to build the rest of the
application.
So let's start with the first part.
The first part is after we got one number.
So the user input of one number let's get the second number okay.
So we have my number.
Now let's go ahead and add another one.
So I'm going to say int my number two which will also be zero.
So I'm using by the way intellisense which is basically the predictive tool inside of Visual Studio.
And I press enter.
And then it just finalizes the code that is grayed out.
So if I go ahead and say my number, well actually now it doesn't even want to.
But earlier it gave me my number two.
It predicted that I wanted to create a variable called my number two.
And that's why it worked quite well.
So how can I now get the user input for the second number?
Actually, let's clean it up a little bit.
So here at the top we create our two numbers.
Then we ask for the first number.
We let the user input the first number.
We convert the first number into an actual number.
So the first entry that the user gave us and now we want to do the same thing.
So we copy the code from the top.
Then we get the user input once again.
But this time we don't need to create a new user input variable.
We can just overwrite the existing user input variable with whatever the text that comes in anew.
Because we already used it up, so we don't need it anymore, at least the value.
Not anymore.
We use however the variable once again.
Okay, so now we are going to go ahead and use my number two int parse user input.
So we do the same thing that we did here.
But this time we're storing it in my number two.
Why don't we just use my number one again because we want to add them together okay.
So if you managed everything up to here good job.
If you didn't try harder next time I really recommend that you code along and really try the exercises
yourself.
So now what we need to do is we need to do the calculation and print the output.
So instead of saying you entered we're going to say the result of.
And here we can use my number.
And this is going to be a plus.
My number.
Then we have another plus.
And my here another plus.
My number two plus is and then we're going to have a result.
So we can either do the calculation in here or we can have another variable which will contain the sum.
So I'm going to create another variable which I'm going to call sum.
And that will be my number plus my number two.
So now these two numbers are added together and they're stored inside of this variable sum.
So now I can use this variable sum and write it out here okay.
Now let me scroll out so you can see the entire line.
It says Console.WriteLine.
The result of my number and my number two is sum.
So why do I have these pluses in between all the time?
Basically, if I just write my number here then this will not consider the variable.
My number.
This will just be a text of the string because it's inside of the quotations here.
So these quotations make everything inside them text just a string.
But my number I want to access this variable which is outside of that string.
That's why I'm using this plus sign.
And then I use the integer variable.
Then I use another plus sign because I now want to go on with a string type.
So I use the string here.
And I do the same thing with my second number with another string and the sum.
So if I now run my code, I will be asked for the first number.
Enter a whole number.
I'm going to say 25 and a whole number another 25.
And you see the result of my number 25 and 25 is 50.
So that's what this my number is okay.
It was in there and let me get rid of it.
And let's run this again.
So enter a whole number 15 and 33.
And you see the result is 48.
So now we have our little calculator here or our addition calculator.
Very simple.
It cannot divide.
It cannot do multiplication.
It can do neither of that but it can do addition quite well.
All right.
So that's one way of building this little application.
In the next video I want to show you an alternative for this very I would say inconvenient way of writing
out or using variables inside of a longer string.
So that's what we're going to see in the next video.
So first of all, congratulations for building this application.
It's pretty cool.
You have your first little usable app because everything until that point was really not worth mentioning.
But now you actually have an addition calculator.
So congrats on that and let's keep going.