Common C++ Built-in Functions:
The commonly used built-in functions are discussed below:
The “conio.h” Function:
The “conio.h” stands for console input/output. This header file contains basic input & output functions that are used to get data from the keyboard and to send results from the memory to the output screen. A brief description of commonly used functions of this header file is given below.
The “clrscr” Function:
The “clrscr” stands for clear screen. This function is used to clear the screen of the computer. When this function is executed, the screen is cleared and the cursor shifts to upper left corner, i.e. to row 1 and column 1 of the screen.
Its syntax is: clrscr( );
The “gotoxy” Function:
The “gotoxy” function shifts cursor on the screen to a specified location. This function is used when an output is to he printed on a specified location on the screen. Its syntax is: gotoxy(x, y);
Where
x: the x co-ordinate (or column) on the screen. Its value may he from 0 to 79.
y: the y co-ordinate (or row) on the screen. Its value may he from 0 to 24.
The “clreol” Function:
The “clreol” stands for clear end of line. This function is used to clear a single line from the current cursor position up to the end of line. The other text printed on the screen is not cleared.
Its syntax is: clreol( );
The “getch” Function:
The “getch” stands for get character. This function is used to get a single character from the keyboard during program execution. When a key is pressed:
• The entered character is not displayed on the screen
• Pressing of the Enter key is not required to complete the input. The control shills to the next statement as soon as any key is pressed.
This function is normally used to pause the execution of program. Its syntax is:
[var = ] getch( );
The use of [var = ] is optional. It is used to store the value of the character entered from the keyboard.
The “getche” Function:
This function is similar to “getch’. It is also used to get a single character from keyboard during the program execution. The main difference between “getch” and “getche” is that the entered character is displayed on the screen when “getch” function is used.
Its syntax is: [var = ] getche ( );
The use of [var = ] is optional. It is used to store the value of the cha racier entered from the keyboard.
The “kbhit” Function:
The “kbhit” stands for keyboard hit. This function checks the keyboard hit and returns a non-zero value when a key on the keyboard is hit during program execution. Otherwise it returns zero value.
Its syntax is: [var = ] kbhit( );
The use of [var = ] is optional. It is used to store the value of the character entered from the keyboard.
comment closed