————————————————————————————
//This is a simple Hello World Program.
#include <iostream.h>
int main()
{
cout<<"Hello World";
return 0;
}
————————————————————————————
//This is a simple Hello World Program.
That line of code is a comment. It is useful for commenting pieces of code. You could do it to remind you about a certain thing in your program.
So after cout we have the “<<” sign. The << operator causes whatever expression is on its right side to be outputted. The opposite way makes the expression inputted, how ever that can only be used for cin or anything similar to it.
I will explain about cin later on in this tutorial.
Ok, so we have cout<<”Hello World”;
Whenever you want text to be outputted onto the console, we type that text in between 2 speech marks. The message “Hello World” is a string. Text enclosed between double quotes are known as strings.
So what about the semicolon? Why do we have that at the end of the line??
This is because C++ statements end with a semicolon.
So now we have gone through a basic C++ Program. Going through this should of given you a good understanding of what is used in a common C++ Program will have.
Now lets go through some more things.
{
cout<<"Hello World";
return 0;
}
————————————————————————————
//This is a simple Hello World Program.
That line of code is a comment. It is useful for commenting pieces of code. You could do it to remind you about a certain thing in your program.
- #include <iostream.h>
- int main()
- cout<<"Hello World";
So after cout we have the “<<” sign. The << operator causes whatever expression is on its right side to be outputted. The opposite way makes the expression inputted, how ever that can only be used for cin or anything similar to it.
I will explain about cin later on in this tutorial.
Ok, so we have cout<<”Hello World”;
Whenever you want text to be outputted onto the console, we type that text in between 2 speech marks. The message “Hello World” is a string. Text enclosed between double quotes are known as strings.
So what about the semicolon? Why do we have that at the end of the line??
This is because C++ statements end with a semicolon.
- return 0;
- }
So now we have gone through a basic C++ Program. Going through this should of given you a good understanding of what is used in a common C++ Program will have.
Now lets go through some more things.
0 comments:
Post a Comment