Login or Register

  Welcome: Guest


Home >> Article >> Programming >> C/C++ >> Post New Article Bookmark and Share

Basic C++ program

December 15, 2012  by: Joseph  Points: 12   Category: C/C++  Earning $0.70   Views: 608

C++ is computer language which help the user to create programs. It is interesting to study this language and making small programs. This article help you to study some basic of C++ programming with a small example. I gore that you will like this article. For +1 and +2 computer opted students C++ is an important subject and also for many course studies this language is needed.

         

C++ is a computer language which help the user to create program, software and games. Group of program together form a software. It is not easy to study a computer language and try to develop program. It need some logic and interest to study language. Starting with small program. This is only a small program which is the basic of C++ programs

//welcome
#include[iostream.h]
int main()
{
cout<<"Welcome to C++";
return 0;
}



This is a small program which display 'welcome to C++' in a new screen.
Below is an example of a program written in C++.



Step 1

: //welcome
- This line is known as comment line which give a statement to a program. Actually this line is not an important thing in a program. If you want you can write or not. Comment line help to explain a function of a line. You can write this comment line in anywhere in a program or you can write anything . // this represent the comment line. When compile a program this line will not be added.

Step 2

: #include[iostream.h]
- ( actually the bracket of iostream.h is < and > . Using [ ] this bracket in a program is an error. This is due to some technical problem please feel sorry) This is an important line in a program without this line we can't give anything into the computer or not to display in the screen. iostream means input output stream. Cout and cin are worked with this line. #include is a header file it is a preprocessor. Without this line it is not easy to run a program.

Step 3

: int main( )
- This is also an important part of a program . Every program require main( ) to run a program. So it is used in a program.

Step 4

: {
- This is from where a program is going to start. A program is written in between two[ { ,} ] curve brackets. Actually the main function of a C++ program is started from here. It is also an important part of a program.

Step 5

:
cout<<"Welcome to C++";
- This is a program line which tell the computer to display the the message ' Welcome to C++ '. If you want to write your name or anything on a screen you can use this line. "Cout<<" means to display the message in as an output. You can write your message like this cout<<"your message"; .
One most important thing in a program is to put semicolan ( ; ) in the end of a program line from the open curve bracket( { ) to the close curve bracket ( } ). If it is not there it will be an error.

Step 6

: return 0;
- This line indicate that the program is ended and nothing is needed to display after it. In step 3, i wrote int main( ) this line work due to this. There is an another option for return 0 it is you have to add void main ( ) in the step 3, and there will not require any return 0 in the program . This line is also end with ; .

Step 7

: }
- As i say before this bracket is for indicating the end of a program. All the program are ended with this bracket.
Below is an example of a program output to show a message.



All the step are over to run this program you have to enter it in the C++ . And there is an option which is known as compile in there press run to do this program.
Turbo C++ version 3.0 are allowed in the internet - http://s1.freedownloadme.info/turboc.zip . This only a small program which is the basic of all C++ programs.
All the best.




Comment(s)

No response found. Be the first to respond to this post

Post Comment

Please Log In  to post comment

Related Resources



Basic Trick of Business & Investment
This Article will explain the tricks in a business or investment.

Basic Things to Consider When Purchasing a Hard Drive
This article provides detailed information on what things to consider when buying a computer hard drive. I wrote the three basic but critical aspects that should be considered on a hard drive like compatibility, storage capacity, and hard drive speed.

Basic Tags and Formatting in HTML
This article explains the Basic Tags and Formatting in HTML.

Four basic steps to choose a good web hosting
Four basic steps to choose a good web hosting

Basic ways to have long and thick hair
Long, soft, and thick hair always inhances beauty of a lady. But hair needs special care to maintain its growth and thickness. In this article we will discuss few ways to have long and thick hair.

Latest Resources From The Same Category



C program for execution for quick sort
Are you looking for c programming code for the execution of quick sort? Here is a C program with simple coding for execution of Quick sort. Read this complete article.

Basic C++ program
C++ is computer language which help the user to create programs. It is interesting to study this language and making small programs. This article help you to study some basic of C++ programming with a small example. I gore that you will like this article. For +1 and +2 computer opted students C++ is an important subject and also for many course studies this language is needed.

How to write a c program to find factorial using recursion
guide on how to use recursion in c to write a program to find the factorial of a number with necessary algorithms and code examples.

 

Top Performers     Top Contributors     Share and Earn     Terms of Service    Privacy Policy     Contact Us