OK you written a program, or found a program on internet, and now you want to compile it on linux... you need to use gcc (which is c compiler) and g++ (which c++ compiler). Most of the options are same on both compilers so i will speak about compiling c program on linux.

Now here is a program which you have written or downloaded from internet, helloworld.c

Code:
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char** argv){
 printf("Hello world\n");
 return 0;
}
Now once i have done with program, i have to compile it. Compilation is the process of converting human readable code into a form which the machine can understand. So to compile the above program, i give the following command on console or shell or terminal i don't know what you call it.

Code:
$ gcc helloworld.c

If there are no syntax errors, the program will be successfully compiled and the compiler will create an executable file named, a.out. If you want your compiler to give different name then, use this option.

Code:
$ gcc -o hello helloworld.c
Now simply execute it.

Code:
$./a.out

the result will be display.. in this manner you can port your all c or c++ programs in linux.