Hello, we're going to do the typical C or C++ hello word, first we have to install codeBlocks, by clicking on downloads and then on download the binary release:
Then click on your platform, I've windows so, if you've windows click codeblocks-16.01mingw-setup.exe, you can download it in Sourceforge.net or FossHub,
then install it.
When it has finished you will start,
Then start to code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Hello word. \n");
return 0;
}
Do you know how this code works?
If the answer's no don't worry, I'm going to explain it, if the answer's yes, like and inizialize code.
#include <stdio.h>
#include <stdlib.h>
This part of the code include libraries that allow to use functions such as
return 0;
int main()
{
}
You put here the commands except of functions, libraries... .
printf("Hello word. \n");
We're going to descompose this part of the code.
printf()
Write in the monitor,
"Hello word. \n"
- The "" indicate that it's text,
- Hello word. Write it in the monitor,
- \n skip a line,
;
; finishes the line.
return 0;
Finishes the code, and the ; finishes the line. Now we're going to run the code, you press f9, if the program give you an error, the code is wrong revise it.
Then you will see this:
Good bye.
Comments
Please log in or sign up to comment.