Programming

Let’s start with c/c++…….

Before jumping into any programming language the very first program you perform is Hello World
by doing this program you’ll understand the basic output or standard output of any language.

hello world in c and c++

C:
//this is single line comment.
//comments are the lines skipped by compiler.Comments are useful to mark or note when writing large programs

#include <stdio.h>//including header file

/*this ia multiline comment
and main() is function containing main program main() is mandatory*/

void main()
{
printf(“Hello World!!!”);
/*printf is function defined in the
stdio.h file and hence we need stdio.h file in headers.*/
}

C++: almost same as C program note the changes

#include <iostream>//in most modern compilers we do use iostream and not iostream.h

using namespace std;
void main()
{
cout<<“Hello world”;
//while saving use extension .cpp for c++ and .c for c program
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s