Hello World blog

--Originally published at Solving problems with programming

Im very late to start blogging, but better late than never, so i say helloworld to blogpost. To get started we have a very easy exercise, is the greeting to C++. We will print hello world in the terminal and to do it we need some basic elementes.

#include
using namespace std;

int main()
{
cout <<“Hello world.”<< endl; return 0;
}

#include <iostream> are the libraries that you add to your program. Libraries are a collection of  functions, and functions are a sets of code that do an specific processes. Later on other WSQ we will do our own functions.  The iostream library is the one that lets the program get information in and infromation out. The way you get information in and out is with cout and cin.

Int main() is a function, and is the function of you main program, in c++ everything works with functions and your program is function. We will understand it better later.

cout<<“Hello world.” The cout is what prints our message. the couts need << to say what is going to get out. Being that the infomatino getting out is a string we have to put it in quotes. Strins is the type of data that are letters.

<<endl; We wanto to make a space and beggin in a new line so that is infomation out, for that we have to put another <<, but not another cout, we just have to write it again just if we get information in, and is for the program to identify what is in and what is out. Being that that is the end of our statement, we have to put “;”. Semicolons go always at the end of the statements.

return 0; Finally the return statement is a rule, every funtcion needs

Continue reading "Hello World blog"