Hello World C C++

You can obtain a few version of a c/c++ compiler from GNU, but if you are using Linux then you should have the compiler already installed.

To display the classic Hello World, save this code below

#include <iostream>
 
int main(void)
{
  std::cout << "Hello world!!";
}

as helloworld.c

Then to compile (if using gcc) into the platform that you are using

#Linux
g++ helloworld.c -o helloworld
#Windows because windows likes .exe
g++ helloworld.c -o helloworld.exe

to run the program, you just need to execute the helloworld file that was created from the above command, if you are using Windows, then you will need to change the line to

The output should be

Hello world!!

Well that is the classic!!

Leave a Reply

Your email address will not be published.