Blog

Turbo C++ Tutorials

Turbo C++ Tutorials

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.

  1. Download Turbo C++ (find a compatible version for your OS).
  2. Install it.
  3. 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:

  1. A menu bar at the top.
  2. A status bar at the bottom.

Creating a New Program

  1. Go to File > New or simply press F3.
  2. 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

  1. Save the program by going to File > Save As. Give it a name with a .cpp extension (like hello.cpp).
  2. To compile, go to Compile > Compile or press Alt + F9.
  3. If there are no errors, you can run the program by going to Run > Run or pressing Ctrl + F9.
  4. You should see “Hello, World!” displayed on the screen.

Fixing Errors

If there are errors in your code:

  1. The compiler will provide an error message.
  2. Navigate to the line with the error.
  3. Make the necessary corrections.
  4. Recompile the program.

Basic Input and Output

  1. For taking input, you can use cin. int number; cout << "Enter a number: "; cin >> number;
  2. As shown above, cout is 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.h for functions like clrscr() (clear screen) and getch() (get character).
  • The void main() function is specific to Turbo C++ and some other older compilers. Modern C++ standards use int main() with a return 0; at the end.