Szaryx News Today: Tibia Review & Basic of C Language

  • Date: 11-05-2009 Views:

    KeyWords: Szaryx News, Tibia, review, basic, c language, :CipSoft, Writer's Club

  • Summary: Szaryx News released today, including Tibia review and Introduction of C Language Basic. Have fun.

Here you will be able to learn some basics of c and c++ languages.

First you need to download Dev C++(It's freeware). You easy find it in internet or download from here.

Let's start with easy program to say Hello World.

#include

This command  let you use commands from library stdio.h (you can find more info about libraries here.

int main() - This command start main function.
{ - This command shows where this function start.
     printf("Hello World!\n"); - Command printf("") shows text.  "\n" is skiping to next line.
     system("PAUSE > NUL"); - Command that stop program until user push Enter
     return 0; - Command to end main function.
}

- This command shows where thisfunction end.

Save this file as "C source files (*.c)", then click on execute and compile (or just use ctrl+f9) and then execute and run (or just use ctrl+f10). You should get message Hello World!

Now something harder. Program that will read number wroted by user and then show it.

#include  
#include  
int main()  
{  
     int number; - command to declare variable int type named "number"
     scanf("%d",&number); - command to read variable "number",
     printf("%d is my number",number); - command to show this variable on screen and also add text (when u just want to show number write printf("%d",number);
     system("pause > nul");  
     return 0;  

}

 

Save it as before, compile and then run. Program should read number wroted by user and then show this number is my number. That's all for today. If you have any problems with programs you can pm me and send me your version and I will check them. If I made somewhere mistake then send me pm and correct me.





Player Comments (Totally Comments)

>> Leave a Comment