有趣的圣诞树

#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<windows.h>
#define I 8
#define R 150.0 
int main()
{
    int i, j, e;
    float a;
    int t1;
    for (i = 1, a = I; i <= I / 2; i++, a--){
        t1 = 6;
        while (t1--)printf(" ");

        for (j = (int)(I - sqrt(I*I - (a - i)*(a - i))); j>0; j--)
            printf(" ");
        for (e = 1; e <= 2 * sqrt(I*I - (a - i)*(a - i)); e++)
            printf("*");
        for (j = (int)(2 * (I - sqrt(I*I - (a - i)*(a - i)))); j>0; j--)
            printf(" ");
        for (e = 1; e <= 2 * sqrt(I*I - (a - i)*(a - i)); e++)            
            printf("*");                                 
          for (j = (int)(I - sqrt(I*I - (a - i)*(a - i))); j>0; j--)
            printf(" ");

        t1 = (int)(I - sqrt(I*I - (a - i)*(a - i)));
        t1 = 2 * t1;
        t1 += (int)(2 * sqrt(I*I - (a - i)*(a - i)));
        t1 = 20 - t1;

        while (t1--) printf(" ");

        for (j = (int)(I - sqrt(I*I - (a - i)*(a - i))); j>0; j--)
            printf(" ");
        for (e = 1; e <= 2 * sqrt(I*I - (a - i)*(a - i)); e++)
            printf("*");
        for (j = (int)(2 * (I - sqrt(I*I - (a - i)*(a - i)))); j>0; j--)
            printf(" ");
        for (e = 1; e <= 2 * sqrt(I*I - (a - i)*(a - i)); e++)
            printf("*");
        for (j = (int)(I - sqrt(I*I - (a - i)*(a - i))); j>0; j--)
            printf(" ");

        printf("\n");
    }

    for (i = 1; i <= R / 2; i++){

        if (i % 2 || i % 3)continue;

        t1 = 6;
        if (i == 6)printf(">>----");
        else while (t1--)printf(" ");

        for (j = (int)(R - sqrt(R*R - i*i)); j>0; j--)
            printf(" ");
        for (e = 1; e <= 2 * (sqrt(R*R - i*i) - (R - 2 * I)); e++)
            printf("*");
        for (j = (int)(R - sqrt(R*R - i*i)); j>0; j--)
            printf(" ");

        t1 = (int)(R - sqrt(R*R - i*i));
        t1 = 2 * t1;
        t1 += (int)(2 * (sqrt(R*R - i*i) - (R - 2 * I)));
        t1 = 35 - t1;

        if (i == 6){ printf("LOVE"); }
        else if (i == 48){ printf("\b\b\b我爱学习!"); }
        else
            while (t1--) printf(" ");
        for (j = (int)(R - sqrt(R*R - i*i)); j>0; j--)
            printf(" ");
        for (e = 1; e <= 2 * (sqrt(R*R - i*i) - (R - 2 * I)); e++)
            printf("*");
        for (j = (int)(R - sqrt(R*R - i*i)); j>0; j--)
            printf(" ");

        if (i == 6)printf("----->");
        printf("\n");

    }
printf("                                  我爱学习");
    int aaa = 9;

    for (; aaa<99;)
    {
        system("color 0a");
        system("color 1a");
        system("color 2a");
        system("color 3a");
        system("color 4a");
        system("color 5a");
        system("color 6a");
        system("color 7a");
        system("color 8a");
        system("color 9a");

        system("color 0b");
        system("color 1b");
        system("color 2b");
        system("color 3b");
        system("color 4b");
        system("color 5b");
        system("color 6b");
        system("color 7b");
        system("color 8b");
        system("color 9b");

        system("color 0c");
        system("color 1c");
        system("color 2c");
        system("color 3c");
        system("color 4c");
        system("color 5c");
        system("color 6c");
        system("color 7c");
        system("color 8c");
        system("color 9c");

        system("color 0d");
        system("color 1d");
        system("color 2d");
        system("color 3d");
        system("color 4d");
        system("color 5d");
        system("color 6d");
        system("color 7d");
        system("color 8d");
        system("color 9d");

        system("color 0e");
        system("color 1e");
        system("color 2e");
        system("color 3e");
        system("color 4e");
        system("color 5e");
        system("color 6e");
        system("color 7e");
        system("color 8e");
        system("color 9e");

        system("color 0f");
        system("color 1f");
        system("color 2f");
        system("color 3f");
        system("color 4f");
        system("color 5f");
        system("color 6f");
        system("color 7f");
        system("color 8f");
        system("color 9f");

    }

}
这是在网上看到的圣诞树代码,感觉挺好玩的就转过来了(虽然看不是很懂hhh)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值