C语言 生日代码

 我发现还是挺多人收藏这篇博客的,于是乎重新编写了一下,看起来没这么拥挤冗余,但是编码能力有限,很多地方无从下手,无法进一步压缩代码。

 希望这篇博客能够帮助到你们,让这份代码让你想送给的TA感到高兴。 

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <Windows.h>
#include <stdlib.h>
#include <string.h>   


void Heart();
void GengXin(int);
void Finish(int);

int main(void)
{
    int year;

    system("title 生日快乐!");
    printf("请输入年份:");
    scanf("%d", &year);

    // 函数
    GengXin(year);
    Finish(year);
    Heart();

    // 结束行
    printf(" :)\n");
    Sleep(100000000000000);

    return 0;

}

// 心形代码
void Heart()
{
    float x, y, a;
    for (y = 1.5; y > -1.5; y -= 0.1)
    {
        Sleep(100);
        for (x = -1.5; x < 1.5; x += 0.05)
        {
            a = x * x + y * y - 1;
            putchar(a * a * a - x * x * y * y * y <= 0.0 ? '*' : ' ');
        }
        putchar('\n');
    }
}

void GengXin(int year)
{
    printf("系统正在检测,请稍等……\n");
    Sleep(1000);
    printf("已检测10%%……\n");
    Sleep(100);
    printf("已检测20%%……\n");
    Sleep(100);
    printf("已检测40%%……\n");
    Sleep(100);
    printf("已检测60%%……\n");
    Sleep(300);
    printf("已检测80%%……\n");
    Sleep(300);
    printf("已检测90%%……\n");
    Sleep(500);
    printf("已检测99%%……\n");
    Sleep(1000);
    printf("已检测100%%……\n");
    Sleep(100);
    printf("检测完成\n");
    printf("恭喜您!完成为期一年的生活副本\n");
    Sleep(1000);
    printf("为感谢各位玩家长期以来对地球OL的大力支持,现发放额外奖励\n");
    Sleep(1000);
    printf("正在发放奖励…\n");
    Sleep(1000);
    printf("本次奖励发放如下:\n");
    Sleep(1000);
    printf("1. 获得健康BUFF,提高身体恢复速度\n");
    Sleep(500);
    printf("2. 永久获得活力加成,时刻获得好心情\n");
    Sleep(600);
    printf("3. 幸运值MAX\n");
    Sleep(700);
    printf("4. 快递无需等待\n");
    Sleep(800);
    printf("5. 获得双倍金币加成\n");
    Sleep(1000);
    printf("奖励发放完毕…进行版本更新检测…\n");
    Sleep(2000);
    printf("发现新的版本 LIFE V%d\n", year);
    Sleep(1000);
    printf("正在下载更新内容……\n");
    Sleep(3000);
    printf("本次更新预计用时1个月,届时开启新的副本和任务,感谢各位的支持……\n");
    Sleep(1500);
}

// 完成结束行,末尾可自行修改名字
void Finish(int year)
{
    printf("#:/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\0x040a\n");
    Sleep(500);
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\0x040b\n");
    Sleep(200);
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\setup\n");
    Sleep(200);
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\1053.mat\n");
    Sleep(200);
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\0x04113\n");
    printf("\n\n\n\n");

    Sleep(200);
    printf("#/You cannot improve your past, but you can improve your future. Once time is wasted, life is wasted.\n");
    Sleep(200);
    printf("#/Knowlegde can change your fate and English can accomplish your future.  \n");
    Sleep(200);
    printf("#If you do not learn to think when you are young, you may never learn. ( Edison ) \n");
    Sleep(200);
    printf("#Dont aim for success if you want it; just do what you love and believe in, and it will come naturally. \n");
    Sleep(200);
    printf("#/If there were less sympathy in the world, there would be less trouble in the world. ( O. Wilde )  \n");
    Sleep(200);
    printf("\n");
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\0x04113\n");
    Sleep(200);
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\0x04113\n");
    Sleep(200);
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\0x04113\n");
    Sleep(200);
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\0x04113\n");
    Sleep(200);
    printf("#/C:\\Program Files (x86)\\InstallShield Installation Information\\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\\1053.mat\n");
    Sleep(200);

    for (int i = 0; i < 10; i++)
    {
        Sleep(200);
        printf("*\n");
    }

    for (int j = 0; j < 7; j++)
    {
        Sleep(100);
        printf("#:// Only with the mind can we  see the essence of things. What is really important is invisible to\n");
    }

    printf("*\n");

    for (int j = 0; j < 5; j++)
    {
        Sleep(100);
        printf("#:// Only with the mind can we  see the essence of things. What is really important is invisible to\n");
    }

    for (int n = 15; n > 0; n--)
    {
        Sleep(100);
        for (int l = 0; l <= n; l++)
        {
            printf("0");
        }
        printf("**\n");
    }
    Sleep(100);
    printf("*\n");
    Sleep(100);
    printf("*\n");
    Sleep(100);
    printf("*\n");
    Sleep(100);
    printf("*\n");
    Sleep(100);
    printf("0000000000000000000000000000000000**\n");
    Sleep(100);
    printf("………………\n");
    Sleep(100);
    printf("Finish.\n");
    Sleep(100);
    printf("Finish.\n");

    for (int m = 0; m < 8; m++)
    {
        Sleep(100);
        printf("*\n");
    }
    Sleep(100);
    printf("更新完成!\n");
    Sleep(1000);
    printf("版本: LIFE V%d\n", year);
    Sleep(1000);
    printf("老赵,生日快乐,祝您生活愉快!\n");
    Sleep(1000);
}
void Heart()
{
    float x, y, a;
    for (y = 1.5; y > -1.5; y -= 0.1)
    {
        Sleep(100);
        for (x = -1.5; x < 1.5; x += 0.05)
        {
            a = x * x + y * y - 1;
            putchar(a * a * a - x * x * y * y * y <= 0.0 ? '*' : ' ');
        }
        //system("color 0c"); // 爱心更改为红色
        putchar('\n');
    }
}

如果想要更改爱心颜色,在这个函数的末尾注释掉的system 这行代码,更改color 0c这个背景色代码,0 表示命令行背景颜色,c表示文字颜色,具体大家可以去CSDN上搜,有详细代码表示。

视频效果图 

C语言 生日代码

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
心中带点小风骚的头像心中带点小风骚普通用户
上一篇 2023年12月8日
下一篇 2023年12月8日

相关推荐