Hello there, it's Aaron, and I'm here to show you how to make a Hello World program in the C and C++ programming languages.
First, go to the text editor of your choice, but personally, in my opinion, I recommend a IDE like Code::Blocks or even MonoDevelop (Which requires the Mono Runtime which you can get off Ubuntu Software Centre.) Then input this into the text editor window below. *NOTE IN C.
Code:
#include <stdio>
int main(char argc, int argv[1])
{
printf("Hello World!\n");
; return 0;
}
Then save this as a .c in the folder of your choice.
But if you want to make a hello world program in C++, however, which, in my opinion, I don't like very much.
Repeat step 1, but this time, input the code below, instead of the code above:
Code:
#include <iostream>
using namespace std;
int main()
{
std::cout << "Hello World" << std::endl;
; return 0;
}
This time, for step 3, save it AS A .CPP or it will not compile with GNU GCC or any compiler in general.
Word of advice, I heavily suggest putting a semicolon both before and after the return statement, as compiling it without that will result in a error if you try to compile it and/or run it.
Aaron out!!!!