Sunday 2 August 2015

How to run a c++ program

C++

Hai, this tutorial will teach you how to run a c ++ program, although you don’t have much knowledge about it.
Let me something tell about C++. C++ is a middle-level programming language developed by Bjarne Stroustrup starting in 1979 at Bell Labs. C++ runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

In the early 1970s, Dennis Ritchie of Bell Laboratories was engaged in a project to develop a new operating system.  Ritchie discovered that in order to accomplish his task he needed the use of a programming language that was concise and that produced compact and speedy programs. This need led Ritchie to develop the programming language called C.

     In the early 1980's, also at Bell Laboratories, another programming language was created which was based upon the C language.  This new language was developed by Bjarne Stroustrup and was called C++. 

 

 
Bjarne Stroustrup
 
Bjarne-Stroustrup
Developed at AT&T bell laboratory
AT&T


The C++ program is written in high level language and it cannot be directly understand by the system, so a compiler(converts high level language to machine level language) is needed.
I prefer Turbo c++ compiler in which we can compile both c and c++ programs.
DOX-BOX
Let we start our coding…..
In order to program we need a compiler so download Turbo c++ software
download-turbo-c++
click-link
Click the Download
click-download
If you have Internet Download Manager click Start Download otherwise it will be normally downloaded in the web browser.
.start-download
Then Install the Turbo c++
double-click
Next
I-agree
Click The Install
Install
Then Installing will be started
Installing
Finish
After the installation completed the Turbo c++ compiler will be opened with a pre-defined graphic program.
[Note: press ALT+Enter to make the compiler minimize and maximize.]
Compiler
Then go to FILE click new
new
So after the new screen is opened save it as filename.cpp
save-as
For example demo.cpp and click OK
 
demo.cpp
SO type the following simple C++ program to print “This is my first c++ program” in the output screen
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<“this is my first c program”;
getch();
}
c++-program

After typing the program save it again,  we have to compile the program, to compile click the Compile option or you can use the short cut key  Alt+F9
Compile

Then it checks for any error and it will display the number of errors and warnings. If the program is right it will show the error and warnings as 0.
Compiled

Then it is time to run the program and get the output.
click the Run option or use the shortcut key Ctrl+F9
Run

Then the output will be displayed
output

we have successfully got the output.
Thus the simple program in C++ is implemented successfully.
In the upcoming tutorials I will teach C++ and the Object Oriented Concepts  more specifically…

3 comments :