A very simple C++ program "HELLO WORLD"
Today I am going to discuss about one of the most popular and most simple C++ program. This is also my first program in C . The main reason to publish this post is to develope a concept about C/C++ language for the beginners. And there is another reason, I have just installed a syntax highlighter in my blog and I like to test it. This C++ code is verry simple and only gives you one output "Hello World" .
Let's starts programming, shall we? :D-
Open your compiler and write the code snippets below-
Done??? Now compile this code, and Run it....
Got the output??? If you did everything right then you will see the output- "HELLO WORLD" on the screen.
If you want to make similar program using C language, then it will look something like this-
In C++ we use the 'cout' for printing output and ' cin ' for assigning values in the program. But in C we use 'printf' and 'scanf' instead of 'cout' and 'cin'. And 'endl' is used for telling the compiler "this is the end of line" .But in C we use "\n" to go to a new line. I will show more uses in my next posts. Until then see ya :)
Let's starts programming, shall we? :D-
Open your compiler and write the code snippets below-
#include<iostream> using namespace std; int main() { //This line will tell the compiler what to print cout<<"Hello World!"<<endl; return 0; }
Done??? Now compile this code, and Run it....
Got the output??? If you did everything right then you will see the output- "HELLO WORLD" on the screen.
Hello World!
If you want to make similar program using C language, then it will look something like this-
#include<stdio.h> using namespace std; int main() { //This line will tell the compiler what to print printf("Hello World!,\n"); return 0; }
In C++ we use the 'cout' for printing output and ' cin ' for assigning values in the program. But in C we use 'printf' and 'scanf' instead of 'cout' and 'cin'. And 'endl' is used for telling the compiler "this is the end of line" .But in C we use "\n" to go to a new line. I will show more uses in my next posts. Until then see ya :)