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. 幸运值MAXn");
    Sleep(700);
    printf("4. 快递无需等待n");
    Sleep(800);
    printf("5. 获得双倍金币加成n");
    Sleep(1000);
    printf("奖励发放完毕…进行版本更新检测…n");
    Sleep(2000);
    printf("发现新的版本 LIFE V%dn", 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}\0x040an");
    Sleep(500);
    printf("#/C:\Program Files (x86)\InstallShield Installation Information\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\0x040bn");
    Sleep(200);
    printf("#/C:\Program Files (x86)\InstallShield Installation Information\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\setupn");
    Sleep(200);
    printf("#/C:\Program Files (x86)\InstallShield Installation Information\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\1053.matn");
    Sleep(200);
    printf("#/C:\Program Files (x86)\InstallShield Installation Information\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\0x04113n");
    printf("nnnn");

    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}\0x04113n");
    Sleep(200);
    printf("#/C:\Program Files (x86)\InstallShield Installation Information\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\0x04113n");
    Sleep(200);
    printf("#/C:\Program Files (x86)\InstallShield Installation Information\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\0x04113n");
    Sleep(200);
    printf("#/C:\Program Files (x86)\InstallShield Installation Information\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\0x04113n");
    Sleep(200);
    printf("#/C:\Program Files (x86)\InstallShield Installation Information\{DA5623C3-0F05-4B6F-AB90-743A279EC8F8}\1053.matn");
    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 ton");
    }

    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 ton");
    }

    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%dn", year);
    Sleep(1000);
    printf("老赵,生日快乐,祝您生活愉快!n");
    Sleep(1000);
}

视频效果图 

C语言 生日代码