zoukankan      html  css  js  c++  java
  • 钻石图案

    #include <math.h>
    #include <graphics.h>
    main()
    {
        int x0 = 320, y0 = 240;
        int n = 25, i, j, r = 180;
        int x[50], y[50];
        int gdriver = DETECT, gmode;
        initgraph(&gdriver, &gmode, "");        /*图形方式初始化*/
        cleardevice();           /*清屏*/
        setbkcolor(WHITE);          /*设置背景颜色为白色*/
        setcolor(GREEN);           /*设置绘图颜色为绿色*/
        for (i = 0; i < n; i++)
        {
            x[i] = r * cos(2 *3.1415926 * i / n) + x0;      /*确定横坐标*/
            y[i] = r * sin(2 *3.1415926 * i / n) + y0;      /*确定纵坐标*/
        }
        for (i = 0; i <= n - 2; i++)
        {
            for (j = i + 1; j <= n - 1; j++)
                line(x[i], y[i], x[j], y[j]);        /*将上面确定的各点之间进行连线*/
        }
        getch();
        closegraph();           /*退出图形界面*/
    }
  • 相关阅读:
    Django搭建环境
    python切片
    python数据类型
    jquery 淡入淡出属性
    Jquery Tab切换
    jQuery Clone方法
    jQuery属性操作
    python 变量以及循环
    获取网站目录
    posting-jsonobject-with-httpclient-from-web-api
  • 原文地址:https://www.cnblogs.com/djcsch2001/p/1960137.html
Copyright © 2011-2022 走看看