
Where k is the colour (text colours are from 30 to 37 and background colours are from 40 to 47).

Hides the cursor (Note: the last character is lowercase ‘L’) The values are 1-based, and default to 1 (top left corner) if omitted You can use them inside printf as you use \n and \t. Some important escape sequences are given in Table 1. Since they look rough, we will write our own code for the functions clrscr, getch, gotoxy, textcolor, textbackground, etc. In Standard C, there are escape sequences that can do many operations on the console. Escape sequences use \n for a newline, \t for a horizontal tab, and so on. The int type may be used and some value returned, normally zero (return 0 ).Ĭonsole handling in Standard C is done using escape sequences. Using the void type for the main function itself is an error. The problem with the above code is that it is not compatible with Standard C. So let us see how to work with Standard C. You may use the following code in Turbo C.īut this code cannot be compiled with a standard compiler. C, Turbo and Standard are almost the same (at least at the basic levels).Ĭonsider a simple program to make the background colour of the console blue, and to print the message ‘Hello, World! in white.

There will be no other notable differences. If you are new to Standard C++, use iostream instead of iostream.h and add a line using namespace std after adding all header files. You may replace it with iostream and cout if you are using C++.ģ. For the sake of convenience, I will use only stdio.h and printf from this point onwards. Standard C/C++, ANSI C/C++ and ISO C/C++ are the same.Ģ. Hence it is recommended that you use Standard C/C++ if you are doing anything serious. Turbo C and C++ are proprietary software, while Standard C and C++ are just languages that are supported by Free (Libre) compilers. Turbo C++ was discontinued in 2006, while Standard C/C++ will be sustained for ever (even though the standards might be updated).Ĥ.

Turbo C/C++ are only for DOS (and Windows), while Standard C/C++ is portable.ģ. Turbo C and Turbo C++ are IDEs developed by Borland, which use their C/C++ implementations and compilers, while Standard C and C++ are supported by all famous compilers such as GCC.Ģ.

In the latter part of the article readers are encouraged to write their own code for the clrscr, getch, gotoxy, text color, and text background functions.īefore taking up the matter at hand, it would be useful to note the key differences between Turbo C/C++ and Standard C/C++:ġ. Here’s a close look at the technique and code for console handling in Standard (i.e., ISO/ANSI) C/C++.
