乱七八糟

 #include <graphics.h>   //tc下的图形开发头文件
 #include <stdlib.h>  
 #include <stdio.h>  
 #include <conio.h>  
   
 int main(void)  
 {  
    /* request auto detection */  
    int gdriver = VGA, gmode=VGAHI, errorcode;      //VGA为什么能直接赋值呢?当然可以,在graphics.h中,有enum //XX{,,,VGA} 这就意味着VGA可以直接使用,当做一个int型的变量使用,可以直接赋值。  
   
    /* initialize graphics mode */  
    initgraph(&gdriver, &gmode, "e://tc2");  
   
    /* read result of initialization */  
    errorcode = graphresult();  
   
    if (errorcode != grOk)  /* an error occurred */   //grOK在graphics.h中有定义的,为0
    {  
       printf("Graphics error: %s/n", grapherrormsg(errorcode));  
       printf("Press any key to halt:");  
       getch();  
       exit(1);             /* return with error code */  
    }  
   
    /* draw a cross */  
    line(100,100,150,150);   //画线函数:(1,2)---->(3,4)
    line(100,150,150,100);  
   
    /* set color to yellow */  
    setcolor(YELLOW);        //设置颜色,对于line()、rectangle()和outtextxy()有影响
   
    settextstyle(DEFAULT_FONT,HORIZ_DIR,2);  
   
    /* demo rectangle(),settextjustify() and outtextxy()  */ 
    rectangle(16,16,96,32);  
    settextjustify(LEFT_TEXT,TOP_TEXT);  
    outtextxy(16,16,"ABC");  
   
    rectangle(16,48,96,64);  
    settextjustify(RIGHT_TEXT,TOP_TEXT);  
    outtextxy(96,48,"123");  
   
    /* demo setfillstyle() and bar()      */ 
    setfillstyle(SOLID_FILL,RED);  
    bar(16,80,96,96);  
   
    /* clean up */  
    getch();  
    closegraph();  
    return 0;  
 }  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值