Questions about this topic? Sign up to ask in the talk tab.
CPP
From NetSec
Revision as of 18:56, 22 November 2011 by EnriqueBlackston (Talk | contribs)
C++ is a compiled low-level programming language. It is an enhancement of the language C. The name 'C++' comes from the increment operator in C, which is "++" therefore C++
Because C++ is a compiled language, you will need a compiler to compile your code. Most Linux distributions come with the proper tools such as gcc, and gdb installed. If you do not have these installed, you can install through your respective package manager.
Debian/Ubuntu: apt get build-essential
Arch Linux: pacman -S base-devel
Hello World
Here is a quick example of a "Hello World" application in C++, and how to compile it.
The code
#include <iostream> //preprocessor directive, tells the compiler to 'include' the file "iostream" //This is a comment by the way. /* so is this. except it's a multi-line comment. */ //The compiler ignores comments. //here is our "main" function. int main(int argc, char *argv[]) //argc and argv stand for "Argument Count" and "Argument Vector" { std::cout << "Hello World!" << std::endl; //use cout to print the text "Hello World!" to the console. return 0; //return 0 and exit. } |