Turbo C++ – Simplest Program

Open turbo C++ and type following lines of code.

#include <iostream.h>

int main()

{

cout<<”happy programing ! “;

cout<<”Are you enjoying”<<endl;

return 0;

}

Compile and Run the code. The code will run but before you monitor any output it will exit. In order to see output add a call to function getch(), it is a built in function which gets a character from console but does not output it to the screen, so in order to use it you need to include this “conio,h” header file. Your code should now look like this:

#include <iostream.h>

#include<conio.h>

int main()

{

cout<<”happy programing ! “;

cout<<”Are you enjoying?”<<endl;

getch();

return 0;

}

The above code should work fine now.

If you use Visual Studio, you will find source code for the same program here.
If you use Dev C++, you will find source code for the same program here

About these ads

About b4blogger
I am a student and a blogger who wants to share my knowledge with the world.

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: