最笨的方法打印出Linux系统 可爱的企鹅图标

c语言@Abr分享 打印Linux可爱企鹅

最笨的方法打印出Linux系统 可爱的企鹅图标

欢迎欢迎大家预览本文章

今天给大家分享的这段代码是,用c语言,用最笨的方法实现console中打印Linux系统图标,可爱的企鹅。

先我们看看参考图片和代码效果

Linux系统图标Linux系统图标
代码效果代码效果

接下来爆源代码啦!

//软件名称:linux可爱企鹅图标
//文件名:main.c
//版本:2020.0208.0001
//软件说明:用最简单的方式打印出 Linux系统图标到console(控制台)中。
//作者:A贝尔(Abr)
//时间:2020年02月08日23:45分

#include <stdio.h>
#include <Windows.h>
#include <conio.h>

void color(WORD c);//控制输出字体属性(字体颜色)
void  kongge(int sum);//循环打印空格
void  chars(int sum);//循环打印制定字符(为了效果好一些我用了'#')
void print_linux();//打印Linux系统图标函数


void color(WORD c)
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), c);//设置控制台输出字体颜色值为c的值
}


//循环打印空格函数
void  kongge(int sum)
{
	while (sum--)//循环sum次
		printf(" ");//打印空格
}

//循环打印字符
void  chars(int sum)
{
	while (sum--)//循环sum次
		printf("#");//打印#号
}

void print_linux()
{
		color(0x03f0);//白底黑色字体
		kongge(15);//打印15个空格
		printf("linux...\n");
		printf("\n");//第一行空白

		kongge(15);
		chars(6);//打印6个#号
		printf("\n");//会车

		kongge(13);
		color(0x03f0);//白底黑色字体
		chars(11);
		printf("\n");

		kongge(12);
		color(0x03f0);//白底黑色字体
		chars(13);
		printf("\n");

		kongge(12);
		color(0x03f0);//白底黑色字体
		chars(2);
		color(0x03f7);//白底灰白色字体
		chars(3);
		color(0x03f0);//白底黑色字体
		chars(2);
		color(0x03f7);//白色
		chars(3);
		color(0x03f0);//黑色
		chars(3);
		printf("\n");

		kongge(12);
		color(0x03f0);//黑色
		chars(2);
		color(0x03f7);//白色
		chars(1);
		color(0x03f0);//黑色
		chars(1);
		color(0x03f7);//白色
		chars(1);
		color(0x03f0);//黑色
		chars(2);
		color(0x03f7);//白色
		chars(1);
		color(0x03f0);//黑色
		chars(1);
		color(0x03f7);//白色
		chars(1);
		color(0x03f0);//黑色
		chars(3);
		printf("\n");

		kongge(12);
		color(0x03f0);//黑色
		chars(4);
		color(0x03fe);//黄色
		chars(4);
		color(0x03f0);//黑色
		chars(5);
		printf("\n");

		kongge(12);
		color(0x03f0);//黑色
		chars(2);
		color(0x03fe);//黄色
		chars(8);
		color(0x03f0);//黑色
		chars(3);
		printf("\n");

		kongge(11);
		color(0x03f0);//黑色
		chars(3);
		color(0x03f7);//白色
		chars(2);
		color(0x03fe);//黄色
		chars(4);
		color(0x03f7);//白色
		chars(2);
		color(0x03f0);//黑色
		chars(4);
		printf("\n");

		kongge(10);
		color(0x03f0);//黑色
		chars(2);
		color(0x03f7);//白色
		chars(11);
		color(0x03f0);//黑色
		chars(4);
		printf("\n");

		kongge(9);
		color(0x03f0);//黑色
		chars(2);
		color(0x03f7);//白色
		chars(13);
		color(0x03f0);//黑色
		chars(4);
		printf("\n");

		kongge(8);
		color(0x03f0);//黑色
		chars(3);
		color(0x03f7);//白色
		chars(13);
		color(0x03f0);//黑色
		chars(5);
		printf("\n");

		kongge(7);
		color(0x03f0);//黑色
		chars(3);
		color(0x03f7);//白色
		chars(15);
		color(0x03f0);//黑色
		chars(5);
		printf("\n");

		kongge(6);
		color(0x03f0);//黑色
		chars(3);
		color(0x03f7);//白色
		chars(16);
		color(0x03f0);//黑色
		chars(5);
		printf("\n");

		kongge(5);
		color(0x03f0);//黑色
		chars(4);
		color(0x03f7);//白色
		chars(16);
		color(0x03f0);//黑色
		chars(5);
		printf("\n");

		kongge(5);
		color(0x03f0);//黑色
		chars(1);
		color(0x03fe);//黄色
		chars(2);
		color(0x03f0);//黑色
		chars(1);
		color(0x03f7);//白色
		chars(14);
		color(0x03fe);//黄色
		chars(2);
		color(0x03f0);//黑色
		chars(4);
		color(0x03fe);//黄色
		chars(1);
		printf("\n");

		kongge(5);
		color(0x03fe);//黄色
		chars(4);
		color(0x03f0);//黑色
		chars(1);
		color(0x03f7);//白色
		chars(13);
		color(0x03fe);//黄色
		chars(3);
		color(0x03f0);//黑色
		chars(2);
		color(0x03fe);//黄色
		chars(2);
		printf("\n");

		kongge(4);
		color(0x03fe);//黄色
		chars(5);
		color(0x03f0);//黑色
		chars(2);
		color(0x03f7);//白色
		chars(10);
		color(0x03f0);//黑色
		chars(1);
		color(0x03fe);//黄色
		chars(9);
		printf("\n");

		kongge(1);
		color(0x03fe);//黄色
		chars(9);
		color(0x03f7);//白色
		chars(10);
		color(0x03f0);//黑色
		chars(2);
		color(0x03fe);//黄色
		chars(11);
		printf("\n");

		kongge(3);
		color(0x03fe);//黄色
		chars(8);
		color(0x03f0);//黑色
		chars(1);
		color(0x03f7);//白色
		chars(6);
		color(0x03f0);//黑色
		chars(3);
		color(0x03fe);//黄色
		chars(10);
		printf("\n");

		kongge(1);
		color(0x03fe);//黄色
		chars(11);
		color(0x03f0);//黑色
		chars(9);
		color(0x03fe);//黄色
		chars(6);
		printf("\n");

		kongge(7);
		color(0x03fe);//黄色
		chars(4);
		color(0x03ff);//白色
		chars(11);
		color(0x03fe);//黄色
		chars(3);
		printf("\n");
		color(0x03f0);//黄色
}

int main()
{
	/*
	system("color f0");
	color(0x03fe);//白底黄色字体
	printf("hello world!\n");
	color(0x03f7);//白底灰白色字体
	printf("hello world!\n");
	color(0x03f0);//白底黑色字体
	printf("hello world!\n");
	*/
	system("color f0");//把控制台初始化为白底黑色字体
	print_linux();//调用打印Linux图标函数
	_getch();//按任意键继续(推出)
	return 0;
}
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值