【正文】
ME, wb)。 return 0。 clrscr()。 gotoxy(20, 12)。 return 0。 return 0。 color = random(maxcolor)。 for (i=0。 color = random(maxcolor)。 for (i=0。 maxy = getmaxy() + 1。 printf(Press any key to halt:)。gdriver, amp。 } 函數(shù)名 : putpixel 功 能 : 在指定位置畫一像素 用 法 : void far putpixel (int x, int y, int pixelcolor)。 linerel(4*ARROW_SIZE, 0)。 } /* clean up */ free(arrow)。 /* repeat until a key is pressed */ while (!kbhit()) { /* erase old image */ putimage(x, yARROW_SIZE, arrow, XOR_PUT)。 /* draw the image to be grabbed */ draw_arrow(x, y)。 exit(1)。 /* read result of initialization */ errorcode = graphresult()。 unsigned int size。 程序例 : include include include include define ARROW_SIZE 10 void draw_arrow(int x, int y)。 /* replace the current path and display current environment */ putenv(path)。 strcpy(path,PATH=)。 程序例 : include include include include include int main(void) { char *path, *ptr。\n39。 i10。\n39。 39。 i++) { putchar(VERT)。\n39。 i10。 } 函數(shù)名 : putchar 功 能 : 在 stdout上輸出字符 用 法 : int putchar(int ch)。\r39。 } 函數(shù) 名 : putch 功 能 : 輸出字符到控制臺(tái) 用 法 : int putch(int ch)。 程序例 : include int main(void) { char msg[] = Hello world\n。 printf( \n)。 printf(tp,R)。 printf(tp,I)。 printf(tp,I)。 printf(tp,I)。 if (l==0) strcat(prefix,0)。 l 2。 j 2。 strcpy(prefix,%)。 char buf[7]。 printf(Ten raised to %lf is %lf\n, p, pow10(p))。 printf(%lf raised to %lf is %lf\n, x, y, pow(x, y))。 printf(The polynomial: x**3 **2 + 5x 1 at is %lf\n, result)。 } 函數(shù)名 : poly 功 能 : 根據(jù)參數(shù)產(chǎn)生一個(gè)多項(xiàng)式 用 法 : double poly(double x, int n, double c[])。 getch()。 return 0。 cprintf(Make sure the scroll lock key is off and press any key\r\n)。 closegraph()。 midy = getmaxy() / 2。 printf(Press any key to halt:)。gdriver, amp。 程序例 : include include include include int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode。 fp = fopen(, r)。 else printf(Caps lock off\n)。 32) printf(Num lock on\n)。 if (value amp。 else printf(Control key off\n)。 2) printf(Left shift on\n)。 if (value amp。 } 函數(shù)名 : peekb 功 能 : 檢查存儲(chǔ)單元 用 法 : char peekb (int segment, unsigned offset)。 if (value amp。 else printf(Scroll lock off\n)。 8) printf(Alt key on\n)。 if (value amp。 else printf(Right shift off\n)。 printf(The current status of your keyboard is:\n)。 else printf(Drive %d Name: %11s\n, , )。 /* get file name */ printf(Enter drive and file name (no path ie. a:)\n)。 return 0。 /* output text at the center of the screen*/ /* Note: the . doesn39。 getch()。gmode, )。 程序例 : include include include include int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode。 /* clean up */ getch()。 /* output text starting at the . */ outtext(This )。 exit(1)。 /* read result of initialization */ errorcode = graphresult()。 int midx, midy。 printf(Value %d sent to port number %d\n, value, port)。 } 函數(shù)名 : outportb 功 能 : 輸出字節(jié)到硬件端口中 用 法 : void outportb(int port, char byte)。 int port = 0。 close(handle)。 char msg[] = Hello world。 程序例 : include include include include int main(void) { int handle。 } write(handle, msg, strlen(msg))。 程序例 : include include int main(void) { int value = 64。 return 0。 outportb(port, value)。 程序例 : include include include include int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode。gmode, )。 getch()。 /* move the . to the center of the screen */ moveto(midx, midy)。 outtext(test.)。 } 函數(shù)名 : outtextxy 功 能 : 在指定位置顯示一字符串 用 法 : void far outtextxy(int x, int y, char *textstring)。gdriver, amp。 printf(Press any key to halt:)。 midy = getmaxy() / 2。 closegraph()。 struct fcb blk。blk, 1) == NULL) printf(Error in parsfm call\n)。 程序例 : include include include int main(void) { int value = 0。 1) printf(Right shift on\n)。 else printf(Left shift off\n)。 if (value amp。 16) printf(Scroll lock on\n)。 else printf(Num lock off\n)。 return 0。 value = peekb(0x0040, 0x0017)。 if (value amp。 4) printf(Control key on\n)。 else printf(Alt key off\n)。 if (value amp。 64) printf(Caps lock on\n)。 程序例 : include int main(void) { FILE *fp。 } 函 數(shù)名 : pieslice 功 能 : 繪制并填充一個(gè)扇形 用 法 : void far pieslice(int x, int stanle, int endangle, int radius)。 /* initialize graphics and local variables */ initgraph(amp。 if (errorcode != grOk) /