Introduction
Whenever we write a program in c language we include conio.h and stdio.h as this two header files are necessary to make a simple program. The conio in 'conio.h' standards for Console Input Output. It is a non-standard header file used in C and C++. We should use turbo C/C++ to compile and execute conio.h header file function. Here are some common functions that are mostly used.
clrscr()
This function is used to clear the screen. Whenever we want to clear the printed things in screen we use this function.
getch()
This function is used to hold the output screen. If you don't used this function then the output screen will close in fractions of second.
putch()
The function is used to print only single character. For example:
int main()
{
char a = 'a';
putch(a);
return 0;
}
cprintf()
cprintf() function is used to print output value in the console or output screen as per the format. Here's the way to use it.
int main(void)
{
char string[50];
cprintf(“type string value: ”);
cscanf(“%s”,string);
cprintf(“typed string value is: %s”, string);
return 0;
}
cscanf()
This function is used to read input from the output screen or console. A format specifier is passed to cscanf() function to read input in the required format. Here's the way how we can use it.
int main(void)
{
char string[50];
cprintf(“type string value: ”);
cscanf(“%s”,string);
cprintf(“typed string value is: %s”, string);
return 0;
}
textcolor()
textcolor() function is used to change the color or the text. Colors name which can be used are: BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, WHITE.
Example
int main(void)
{
clrscr();
textcolor(GREEN)
cprintf("This text is in blue color");
return 0;
}
Comments
Post a Comment