C 练习实例58

3045 1
LZH实名认证 2022-3-18 21:06:57 | 显示全部楼层 |阅读模式
题目:学用rectangle画方形。(在TC中实现)。

程序分析:无。

程序源代码:

//  Created by www.runoob.com on 15/11/9.
//  Copyright © 2015年 菜鸟教程. All rights reserved.
//

#include "graphics.h"
int main()
{
    int x0,y0,y1,x1,driver,mode,i;
    driver=VGA;mode=VGAHI;
    initgraph(&driver,&mode,"");
    setbkcolor(YELLOW);
    x0=263;y0=263;y1=275;x1=275;
    for(i=0;i<=18;i++)
    {
        setcolor(1);
        rectangle(x0,y0,x1,y1);
        x0=x0-5;
        y0=y0-5;
        x1=x1+5;
        y1=y1+5;
    }
    settextstyle(DEFAULT_FONT,HORIZ_DIR,2);
    outtextxy(150,40,"How beautiful it is!");
    line(130,60,480,60);
    setcolor(2);
    circle(269,269,137);
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2026 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行