首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> C語言 >> C >> C 語言實例練習

C語言練習實例63:TC繪製同心橢圓動畫

     編輯:C 語言實例練習

C語言練習實例63:TC繪製同心橢圓動畫

本實例繪製 20 個同心橢圓,長軸遞減、短軸遞增,形成動態視覺效果。

源代碼

// Created by www.runoob.com on 15/11/9.
// Copyright © 2015年 菜鳥教程. All rights reserved.
//
#include "stdio.h"
#include "graphics.h"
#include "conio.h"

int main() {
    int x = 360, y = 160, driver = VGA, mode = VGAHI;
    int num = 20, i;
    int top, bottom;
    initgraph(&driver, &mode, "");
    top = y - 30; bottom = y - 30;
    for (i = 0; i < num; i++) {
        ellipse(250, 250, 0, 360, top, bottom);
        top -= 5; bottom += 5;
    }
    getch();
}

說明

ellipse(x, y, stangle, endangle, xradius, yradius) 繪製橢圓弧,此處繪製完整橢圓(0-360度)。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved