In C plus.
Plus the code is executed from the main function.
So the function itself is a collection of statements to perform a specific task.
As a result of this, a program in C plus plus has to contain at least one function named Main.
So this code is the simplest program in C plus plus that will be successfully compiled and run.
So suppose this code is saved in the main dot cpp file.
We can compile the code using the g plus plus compiler by running the command here, g plus plus G,
sym or main.cpp here and then a dot exe.
So whenever we compile something, we're going to get the a dot exe file.
So if we make it here, here, and as you can see here, our file is created right here.
So now we're going to execute it a dot exe.
And as you can see, this is our hello world that we executed from here.
So if an error message appears, the output file will be generated automatically.
So if we run this code compiling command in the windows console, we will get a file named a dot exe
as I said earlier.
So however, if we run the command on the bash shells such as Linux or Mac OS, we will get the file
name named a dot out.
So we can specify the output file name using the dot or option dot or option followed by the desired
file name.
For instance, if the command will write like this here Main.cpp dot minus all here and here, we're
going to make it hoxily dot x and now we're going to make it here.
Here.
And as you can see here, our file name named Hoxily dot X is created right here.
So whenever the dot x oops, hoxily dot x, and as you can see here, our file executed without any
problem.
And as you can see, the actual these are the same size of program because they are the same program
but different file name.
So indeed we run the output file by typing a and then pressing enter on the Windows console or by typing
the auxiliary and then enter on a bash shell.
We won't see anything on the console window if we don't have the stdcout here.
So if we will delete that and make it GCC or g++ main.cpp and a dot exe.
And as you can see, we have we see nothing here because we don't set anything to our program cpp file.
To write something on the screen.
So this is why it's not showing anything now.
So.
If a write like this for example.
Integer E integer E here.
STD.
Let's see.
Out.
Please enter an integer value.
And here.
STD.
Seen here is the and we're going to make it to E here and then STD.
See out.
This is the here.
The value you entered is.
Here, and then we're going to, uh, make it the new line.
Stdcout.
And.
And here.
Like this.
So.
Oops.
Uh, the.
Okay, So in here like this, let me check if the.
Okay.
So.
Now let's run our program here.
And save it.
G Plus, plus, plus, plus main.cpp here and a dot xm this is.
And please enter an integer value in this case 99.
And as you can see here, the value is entered is 99.
So this is just a basic example.
So as you can see here, we appended several lines of code so that the program can print to the console
and the user can give an input to the program.
So initially the program displays text that ask the user to input an integer number.
So after the user types, the desired number and then press enter, the program will print that number.
So we will also define a new variable named E here.
So this is the E of the integer data type.
So this variable is used to store the data in integer data format.
So we will talk about the variables and data types in next lecture.
So here and this you can see here and then here.
So suppose we have the same, um, the presenting code as the main dot cpp.
We can compile it using the g plus plus the main dot cpp.
And as you can see here, and run it like this.
And you can also use the arrow here or parameter or in this case we're going to make it.
For example, show number, show number dot exit and show number dot x.
And as you can see here, uh, 77, the value you entered is 77.
Uh, so now we now know that, uh, the print text to the console, we use the Stdcout command and to
give some inputs to the program, we use the STD sin command here.
So in this file we also see the include Iostream at the beginning of the file, it's used to tell the
compiler where to find the implementation of the Stdcout at and std seen here.
Oops.
Yeah.
So um.
And since their implementation in is stated in the iOS stream file.
So if you delete the stream file, you will see errors in this code.
So since they are not the default here, so we need to input output stream here.
So at the very beginning of the file we can see the.
Lines here that begins, For example, actually, let's write some lines and I want to mention it.
Comments here or Main.cpp Command.
Oxley Academy.
So here.
So this is the double slashes.
So this means that a line won't be considered as a code, so the compiler will ignore it.
So it's used to comment or mark an action in the code so that other programmers can understand our code
here.
So if we compile this, you will get the same result because and the same file size because this code
will ignore by the compiler.
So let's actually make this so the writing so much comments like this should increase the file size.
Right?
So main dot CP here and with comments x and there here.
And as you can see here, the show number is without comments, without comments.
But the with comments here is with comments that we will write it like this.
So and as you can see, the file size is same because the compiler isn't compiled this line of code.
So this is just an a comment.