Monday, February 10, 2025

How to make your first program

 Our first simple program will be simple, it's gooing to display Hello World! on your command line. To do this, we need to:

- Include the library that will allow us to print the message on the command line.

- As it is a standard library, we will need either to use 'std::' every time we use any function of the library or specify that we are using it, so the compiler accept it.

- Then we will create the main function stating "int main(){}". Our code will need to be in between the curly braces.

- Then, using the cout function we will write the 'Hello World!' message.

- Finally, the last line of the main function should be 'return 0'.

Also don't forget to end every line (except from the includes and the function-related lines) with a column ';'

After all this, if we run the program, the message should be printed!


E.g. :


#include <iostream>

using namespace std;

int main(){

    cout << "Hello World!" << endl;

    return 0;

}


How to make your first program

 Our first simple program will be simple, it's gooing to display Hello World! on your command line. To do this, we need to: - Include th...