最笨的方法打印出Linux系统 可爱的企鹅图标
欢迎欢迎大家预览本文章
今天给大家分享的这段代码是,用c语言,用最笨的方法实现console中打印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;
}