|
Turbo C 2.0、Borland C++库函数及用例(14) the\r\n"); cprintf("current text window, without moving the cursor.\ \r\n"); cprintf("Press any key to continue . . ."); gotoxy(14, 4); getch(); clreol(); getch(); return 0; } 函数名: clrscr 功 能: 清除文本模式窗口 用 法: void clrscr(void); 程序例: #include <conio.h>int main(void) { int i; clrscr(); for (i = 0; i < 20; i++) cprintf("%d\r\n", i); cprintf("\r\nPress any key to clear screen"); getch(); clrscr(); cprintf("The screen has been cleared!"); getch(); return 0; } 函数名: coreleft 功 能: 返回未使用内存的大小 用 法: unsigned coreleft(void); 程序例: #include <stdio.h> #include <alloc.h>int main(void) { printf("The difference between the highest allocated \ block and\n"); printf("the top of the heap is: %lu bytes\n\ ", (unsigned long) coreleft()); return 0; } 函数名: cos 功 能: 余弦函数 用 法: double cos(double x); 程序例:#include <stdio.h> #include <math.h>int main(void) { double result; double x = 0.5; result = cos(x); printf("The cosine of %lf is %lf\n", x, result); return 0; } 函数名: cosh 功 能: 双曲余弦函数 用 法: dluble cosh(double x); 程序例:#include <stdio.h> #include <math.h>int main(void) { double result; double x = 0.5; result = cosh(x); printf("The hyperboic cosine of %lf is %lf\n",x,result); return 0; } 函数名: country 功 能: 返回与国家有关的信息 用 法: struct COUNTRY *country( int countrycode, struct country *country); 程序例:#include <dos.h> #include <stdio.h>#define USA 0int main(void) { struct COUNTRY country_info; country(USA, &country_info); printf("The currency symbol for the USA is: %s\n", country_info.co_curr); return 0; } 函数名: cprintf 功 能: 送格式化输出至屏幕 用 法: int cprintf(const char *format[, argument, ...]); 程序例:#include <conio.h>int main(void) { /* clear the screen */ clrscr(); /* create a text window */ window(10, 10, 80, 25); /* output some text in the window */
|