473,508 Members | 2,040 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ


Turbo Borland C++ Introduction

By John Bourbonniere
Developer, PlayZion.com

Introduction to C++

Note: This tutorial is based on using Turbo C++ from Borland Software.

When you first start Turbo C++, you will see a blue screen with the title "NONAME00.cpp". The main area is called the "edit window". This is where you can type code for your programs. The flashing yellow thing is called a cursor. Type in the following code:

#include <iostream.h>
#include <conio.h>
// This is a comment
void main() { clrscr(): cout << "Hello World." << endl; }

As you can see, the text is different colours depending on what type of text it is, and what it's purpose is. This will be explained in greater detail later. If you want, you can use F2 to save your program. To run it, you can either press CTRL + F9, or choose "Run" from the menu at the top of the screen.

If there are errors in your program, a little grey box will come up showing you the errors. Each line in the box shows you a different error for each line of your program.

If there aren't any errors, then your program has run properly. Why can't you see anything? Because you're still looking at the input window. In order to see what happened, select "Window" from the menu at the top, and then pick "Output". It will show you "Hello World". You can switch back to the input window (or edit window) by pressing F6.

Another way of seeing the output of your program is by typing:

#include <conio.h>

at the top of your program, and

getch();

at the very bottom. This will pause the program while the output window is visible until the user hits any key.

 

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.