Tuesday, February 10, 2015

A Note on Compatibility

Like languages we use in our daily life, programming languages also have many dialects. Which dialect to follow depends on the compiler you use. In case of C++, we have an international standard for it, devised by ISO. This is known as ISO C++. It is highly recommended to follow this standard, and to use the compilers which support it. On of the major and powerful compilers which support ISO C++ is a free software, GCC, the GNU Compiler Collection, which you can download and use for free. Click here to know more.

What should Turbo C++ users do

It is highly recommended to update yourself from Turbo C++, and outdated and unsupported C++ variant. However, some universities and institutions still follow this archaic stuff. But the codes in this blog follow ISO C++. Students who are forced to use Turbo C++ should make the following changes in their code in order to make them compatible with Turbo C++:
  • Use iostream.h instead of iostream
  • Don't use using namespace std;
  • You will have to press Alt+F5 after program execution in order to see the output. Or you can include conio.h and then write getch(); just before the return statement of the main function.
Consider the following example:

ISO C++

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello, World!\n";
    return 0;

Turbo C++

#include <iostream.h>
#include <conio.h>

int main()
{
    cout << "Hello, World!\n";
    getch();

    return 0;


Happy coding!

No comments:

Post a Comment