
Turbo C++ was a popular C++ compiler and integrated development environment (IDE) in the late 1980s and 1990s. Although it’s considered outdated in today’s software development environment, many people still have fond memories of starting their coding journey with it.
Turbo C++ Tutorials
If you’re looking to learn or revisit Turbo C++, here’s a basic tutorial:
Setting Up Turbo C++
Before you can start, you need to have Turbo C++ installed on your machine.
- Download Turbo C++ (find a compatible version for your OS).
- Install it.
- Open the Turbo C++ IDE.
Basic Layout
When you open Turbo C++, you’ll be presented with a blue screen. You will see the following:
- A menu bar at the top.
- A status bar at the bottom.
Creating a New Program
- Go to
File>Newor simply pressF3. - You’ll be presented with a blank page to start typing your program.
Writing a Simple Program
Here’s a basic program to display “Hello, World!” on the screen:
#include<iostream.h>
#include<conio.h>
void main() {
clrscr(); // Clear the screen
cout << "Hello, World!";
getch(); // Wait for a key press
}
Compiling and Running the Program
- Save the program by going to
File>Save As. Give it a name with a.cppextension (likehello.cpp). - To compile, go to
Compile>Compileor pressAlt + F9. - If there are no errors, you can run the program by going to
Run>Runor pressingCtrl + F9. - You should see “Hello, World!” displayed on the screen.
Fixing Errors
If there are errors in your code:
- The compiler will provide an error message.
- Navigate to the line with the error.
- Make the necessary corrections.
- Recompile the program.
Basic Input and Output
- For taking input, you can use
cin.int number; cout << "Enter a number: "; cin >> number; - As shown above,
coutis used for output.
Some Points to Remember
- Turbo C++ uses an older version of C++, which means some modern features and libraries may not be available.
- Always include
conio.hfor functions likeclrscr()(clear screen) andgetch()(get character). - The
void main()function is specific to Turbo C++ and some other older compilers. Modern C++ standards useint main()with areturn 0;at the end.
