-
line
(函數)
鎖定
line,是函數,是代碼
- 中文名
- line
- 功 能
- :在指定兩點間畫一直線
- 參 數
- x0y0為直線初始座標X1Y1為末座標
- 頭文件
- graphics.h
line基本釋義
原 形void far line(int x0, int y0, int x1, int y1)
程序例:
#include "graphics.h" #include "stdlib.h" int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int xmax, ymax; /* initialize graphics and local variables */ initgraph(&gdriver, &gmode, ''''); /* read result of initialization */ errorcode = graphresult(); /* an error occurred */ if (errorcode != grOk) { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); } setcolor(getmaxcolor()); xmax = getmaxx(); ymax = getmaxy(); /* draw a diagonal line */ line(0, 0, xmax, ymax); /* clean up */ getch(); closegraph(); /*關閉圖形模式*/ return 0; } #line
命令的基本形式如下:
# line number["filename"]
line舉例
例如,下面説明行計數從1 0 0開始;printf( ) 語句顯示數1 0 2,因為它是語句#line 100後的第3行。
#line 100 /* 初始化行計數器* /
main ( ) /* 行號100 */
{ /* 行號101 */
p r i n t f ( " % d \ n " ,__LINE__ ) ; /* 行號102 */
}遺傳學 長分散核因子
- 詞條統計
-
- 瀏覽次數:次
- 編輯次數:11次歷史版本
- 最近更新: 胡说Y道