Wednesday, August 31, 2011

Your first Program in C/C++ - "Hello World!"


Hello All!! ^_^
I thought to add a new topic to my blog - programming! Being a student of Computer Engineering, I love programming. So I thought why not share the wealth of programming? During my studies, I have seen so many classmates, having problems making simple programs. So I thought, I will share one program every week, in both C and C++ languages and if you have any queries related to them, please feel free to comment and ask! :)

To begin with, I will post the most simplest program which is used to print "Hello World" on the screen!

Language - C (CLICK HERE to Download this Program)

#include<stdio.h>
#include<conio.h>
void main()
{
   printf("Hello World!");
   getch();
}

Now some understanding part. printf() statement helps you to print the string written in quotes inside the parentheses.

Language - C++ , Platform - C++ Compiler(eg. Turbo C++)

#include<iostream>
#include<conio.h>
void main()
{
   cout<<"Hello World"; 
   getch(); 
}

Language - C++ , Platform - Visual C++ Compiler(eg. Visual Studio, DevC++)(CLICK HERE to download this program)

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
    cout<<"Hello World";
    getch(); 
}

The cout(pronounced as C-out) lets to print the output.

So now all of you try to print your name, address, or any other message you people may like to display on your screens using similar syntax!
Good Day! ^_^

2 comments:

  1. Good start but you don't mention how anyone can
    start from beginning and details elaboration. If it had, it would be more enjoyable.

    ReplyDelete
    Replies
    1. Hey thanks! :) I will think about it and start a good tutorial later then :)

      Delete

Kindly keep the comments clean and make quality comments that would be worthy in making this blog better! :)