学了一学期的C语言能干嘛,C语言实现显示汉字(bushi)


前言

这几天,天天网课实在是闲的无聊,想起了大一那会的表白用的c语言代码,给大家分享一下😘嘿嘿


代码技术含量不高,就是最基础的应用,别看篇幅老长了,主要是字库占的篇幅大。中间那些肉麻的话我就不展示啦(/ω\)
这显示的主要内容
在这里插入图片描述

代码如下:

#include <windows.h>
#include <stdio.h>

#define stoptimeshort 40
#define stoptimelong 200
void Zhu()
{
	int ZhuZhu[9][40] =
	{
		0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,		0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0,	
		0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0,		0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0,
		0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,		0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,
		0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,		0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
		0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,		0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
		0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,		0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
		0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,		0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
		0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,		0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0,
		0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,		0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
	};
	
	for (int i = 0; i < 9; i++)
	{
		printf ("\t");
		for (int j = 0; j < 40; j++)
		{
			if (ZhuZhu[i][j] == 0)
				printf (" ");
			else
				printf ("*");
		}
		printf ("\n");
		Sleep(100);
	}
}
void HappyBirthday()
{
	int n = 0;
	int SRKL[9][70] =
	{
		0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,		0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 	0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
		0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0,		0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 		0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 	0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0,		0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 		0, 0, 1, 0, 1, 0, 0, 1, 0, 0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1, 0, 1, 0, 		0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 	0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0,
		0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,		0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 		0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 	0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
	};
	for (int i = 0; i < 9; i++)
	{
		printf ("\t");
		for (int j = 0,n; j < 70;j++,n++)
		{
			if (SRKL[i][j] == 0)
				printf (" ");
			else
				printf ("*");	
		}
		printf ("\n");
		Sleep(100);
	}
}
void I_love_you()
{
	int f[9][43] =
	{
		0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
		0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0,
		0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
	};
	
	for (int i = 0; i < 9; i++)
	{
		system("color cf");
		printf ("\t");
		for (int j = 0; j < 43; j++)
		{
			if (f[i][j] == 0)
				printf (" ");
			else
				printf ("*");
		}
		printf ("\n");
		Sleep(100);
	}
}
void No()
{
	int n = 0;
	int t[9][22] =
	{
	    0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
		0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0,
		1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1,
		1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
		0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0,
		0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
		0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
	};
	
	system("color 0f");
			for (int i = 0; i < 9; i++)
			{
				printf ("\t");
				for (int j = 0; j < 22; j++)
				{
					if (t[i][j] == 0)
						printf (" ");
					else
						printf ("*");
				}
				system("color f0");
				system("color 0f");
				printf ("\n");
				Sleep(100);
			}
			printf("%s", " ");
			Sleep(stoptimelong);
			Sleep(stoptimeshort);
			Sleep(stoptimeshort);
			Sleep(stoptimeshort);
			printf("%s", "心碎了呜呜呜\n");
}

void print(int n)
{
	for (int i = 0;i <= n;i++)
	{
		printf ("\n");
		Sleep(100);
	}
}
int main() 
{
	char ch[10];
	int s[9][21] =
	{
	    0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
		0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
		1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
		1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1,
		0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0,
		0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
		0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
	};
	
	system("color fc");
	system("title ZhuZhu~ Happy Birthday!");
	system("pause");
	printf("%s", " ");
	Sleep(stoptimelong);
	
	Zhu();
	Sleep(1000);
	printf ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
	
	HappyBirthday();
	print(10);

	system("color f1");
	Sleep(stoptimeshort);
	system("color f2");
	printf("\n");
	Sleep(200);
	 
	system("color f3");
	Sleep(stoptimeshort);
	system("color f4");
	Sleep(stoptimelong);
	printf ("\n");
	Sleep(stoptimeshort);
	
	system("color f5");
	Sleep(stoptimeshort);
	system("color f6");
	Sleep(stoptimeshort);
	system("color f9");
	Sleep(stoptimeshort);
	system("color fa");
	Sleep(stoptimeshort);
	system("color fb");
	Sleep(stoptimeshort);
	system("color fd");
	Sleep(stoptimelong);
	printf ("\n");
	Sleep(stoptimeshort);
	
	system("color fe");
	Sleep(stoptimeshort);
	system("color f1");
	Sleep(stoptimeshort);
	system("color f2");
	Sleep(stoptimeshort);
	system("color f3");
	Sleep(stoptimeshort);
	system("color f5");
	Sleep(stoptimeshort);
	system("color f6");
	Sleep(stoptimeshort);
	system("color f8");
	Sleep(stoptimelong);
	printf ("\n");
	Sleep(stoptimeshort);
	
    system("color f9");
	Sleep(stoptimeshort);
	system("color fa");
	Sleep(stoptimeshort);
	Sleep(stoptimelong);
	printf ("\n"); 
	Sleep(stoptimeshort);
	
	system("color fb");
	Sleep(stoptimeshort);
	system("color fd");
	Sleep(stoptimeshort);
	system("color fe");
	Sleep(stoptimeshort);
	system("color f1");
	Sleep(stoptimeshort);
	system("color f2");
	Sleep(stoptimeshort);
	system("color f3");
	Sleep(stoptimelong);
	printf ("\n");
	Sleep(stoptimeshort);
	
	system("color f8");
	Sleep(stoptimeshort);
	system("color f9");
	Sleep(stoptimeshort);
	system("color fa");
	Sleep(stoptimelong);
	printf ("\n");
	Sleep(stoptimeshort);
	
	system("color fb");
	Sleep(stoptimeshort);
	system("color f8");
	Sleep(stoptimelong);
	printf("\n");
	Sleep(stoptimeshort);
	
	system("color fd");
	Sleep(stoptimeshort);
	system("color fe");
	Sleep(stoptimeshort);
	system("color f1");
	Sleep(stoptimeshort);
	system("color f2");
	printf("\n");
	Sleep(stoptimelong);
	system("color f3");
	printf("%s", "(Y/N)");
	scanf ("%s",ch); 
	Sleep(stoptimelong);

	if (ch[0] == 'y' || ch[0] == 'Y')
	{
		system("color cf");
		printf ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
		I_love_you();
		print(10);
		Sleep(3000);
    }
	else
	{
		if (ch[0] == 'n' || ch[0] == 'N')
		{ 
			printf ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
			No();
			print(10);
		} 
		system("color 0f");
		system("pause");
	}
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

想不到名字的小杨

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值