31 May, 2017

First program in C++ language

Here is the first C++ program that will show the "Hello World" output to us.For executing this code on your machine,you have to a compiler that can execute C++ code.Use gcc compiler or other for execute your C++ code.you can use CodeBlock that is a IDE (Integrated Development Environment) provides Editing,Compiling and Executing the codes at one place without suffering.or download the gcc on your machine. I'm using LINUX environment,so for executing this C++ code i am gonna save it with .cpp extension and run the following commands in the saving directory...


g++ demo.cpp -o demo

and after the code being compiled,i am gonna execute that code by following command :


./demo

Here is the C++ code for showing "Hello World" output :

#include <iostream>
using namespace std;
int main()
{
   cout << "Hello World";
   return 0;
}

No comments:

Post a Comment