C++ First Program
Our C++ first program will print out “I am learning C++.” (lets give “Hello world!” some break) on the monitor. Open your compiler, mine is Code::blocks and create a new project name “First program” and copy and paste any of the following code below.
///Code example 1 #include <iostream> //Including iostream library file using namespace std; int main( int argc , char *argv[ ] ) { cout<< “I am learning C++.\n” ; //Printing out on monitor cin.get( ); return 0 ; }
Or
//Code example 2 #include <iostream> //Including iostream library file int main( int argc , char *argv[ ] ) { std::cout<< “I am learning C++.” << std::endl ; //Printing out on monitor std::cin.get( ); return 0; }
Running the above code will produce “I am learning C++.” on the screen with a black background. If you don’t get the output check for any error in the code or any error message given by the compiler.