In almost all programming languages, the first program that people learn is how to print "Hello, World!" to the screen.
So this is what we will be doing now in c++!
So we start off by doing this:
don't worry about using namespace std; for now.
the return 0; is what we need to include at the end of the function because main is an int function. We just return 0 to show that the function has ended.
Your final code should look like this:
So this is what we will be doing now in c++!
So we start off by doing this:
#include <iostream>
using namespace std;
This basically says that we will be using the iostream library to be able to print things out to the console.don't worry about using namespace std; for now.
int main() {
return 0;
}
This is the function where everything will happen ( everything inside the brackets.)the return 0; is what we need to include at the end of the function because main is an int function. We just return 0 to show that the function has ended.
cout << "Hello World!!!" << endl;
This will go inside int main(). All this does is prints out Hello World!!! on the console, and endl just ends the line after that. Remember to include that semicolon at the end of cout.Your final code should look like this:
#include <iosteam>
using namespace std;
int main() {
cout << "Hello World" << endl;
return 0;
}
so just compile and run that and see what you get!
Comments
Post a Comment