你是我绕过人间山河,才遇到的人间烟火。
我见众生皆草木,唯有见你是青山。
山河远阔 , 人间烟火 , 无一是你 , 无一不是你。
突然很喜欢惊鸿一瞥这个词,一见钟情太肤浅,日久生情太苍白,别人眉来眼去,我只看你一眼。
哈哈,开篇点题,先来一波文案。^ - ^
多彩小心心:
一、光标更新
下面函数可以更新光标位置,让你的爱心移动。
注:该函数我从下面文章看到的,我不是太懂:https://blog.csdn.net/qq_40953281/article/details/79315254
void gotoxy(int x, int y)
{
// 更新光标位置,输出心形在屏幕中间
COORD pos;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(hOutput, pos);
// 隐藏光标
CONSOLE_CURSOR_INFO cursor;
cursor.bVisible = FALSE;
cursor.dwSize = sizeof(cursor);
SetConsoleCursorInfo(hOutput, &cursor);
}
二、变色实现
使用死循环改变颜色;max的大小就是控制变色时间,调节max可调整变色频率。
while(1){//死循环变色
system("color a");
for (time = 0; time<maxn; time++);
system("color b");
for (time = 0; time<maxn; time++);
system("color c");
for (time = 0; time<maxn; time++);
system("color d");
for (time = 0; time<maxn; time++);
system("color e");
for (time = 0; time<maxn; time++);
system("color f");
for (time = 0; time<maxn; time++);
system("color 0");
for (time = 0; time<maxn; time++);
system("color 1");
for (time = 0; time<maxn; time++);
system("color 2");
for (time = 0; time<maxn; time++);
system("color 3");
for (time = 0; time<maxn; time++);
system("color 4");
for (time = 0; time<maxn; time++);
system("color 5");
for (time = 0; time<maxn; time++);
system("color 6");
for (time = 0; time<maxn; time++);
system("color 7");
for (time = 0; time<maxn; time++);
system("color 8");
for (time = 0; time<maxn; time++);
system("color 9");
}
完整代码:
#include <stdio.h>
#include <string.h>
#include <Windows.h>
#define maxn 99999999
void gotoxy(int x, int y)
{
// 更新光标位置,输出心形在屏幕中间
COORD pos;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(hOutput, pos);
// 隐藏光标
CONSOLE_CURSOR_INFO cursor;
cursor.bVisible = FALSE;
cursor.dwSize = sizeof(cursor);
SetConsoleCursorInfo(hOutput, &cursor);
}
void main(){
char answer[10];
printf("似乎是上天注定\n\n");
printf("我听说\n天在将黑未黑时最美\n爱在将爱未爱时最迷人\n我在现在\n最想你\n\n");
printf("希望有一天\n聊天记录\n会变成耳边炽热的呼吸\n");
printf("屏幕里的晚安\n会变成额头上的亲吻\n你\n会安静的躺在\n我的身旁\n\n");
printf("我需要牵着\n你的手\n才能告诉你什么是永远\n");
printf("答应我吧!张小姐!!!!!\n输入yes,你可以看到我的真心\n");
scanf("%s", answer);
char a[10] = "yes";
if(strcmp(a, answer) == 0){
int i,j,k,l,m;
int t = 6;
char c='*';
for(i=1;i<4;i++) {
gotoxy(20, t);
for(j=1;j<27-i*2;j++)
printf(" ");
for(k=1;k<=i*4+1;k++)
printf("%c",c);
for(l=1;l<=9-4*(i-1);l++)
printf(" ");
for(m=1;m<=i*4+1;m++)
printf("%c",c);
printf("\n");
t++;
}
for(i=1;i<4;i++) {
gotoxy(20, t);
for(j=1;j<20;j++)
printf(" ");
for(k=1;k<=29;k++)
printf("%c",c);
printf("\n");
t++;
}
for(i=1;i<8;i++) {
gotoxy(20, t);
for(j=1;j<20+2*i;j++)
printf(" ");
for(k=1;k<=29-4*i;k++)
printf("%c",c);
printf("\n");
t++;
}
long time;
while(1){//死循环变色
system("color a");
for (time = 0; time<maxn; time++);
system("color b");
for (time = 0; time<maxn; time++);
system("color c");
for (time = 0; time<maxn; time++);
system("color d");
for (time = 0; time<maxn; time++);
system("color e");
for (time = 0; time<maxn; time++);
system("color f");
for (time = 0; time<maxn; time++);
system("color 0");
for (time = 0; time<maxn; time++);
system("color 1");
for (time = 0; time<maxn; time++);
system("color 2");
for (time = 0; time<maxn; time++);
system("color 3");
for (time = 0; time<maxn; time++);
system("color 4");
for (time = 0; time<maxn; time++);
system("color 5");
for (time = 0; time<maxn; time++);
system("color 6");
for (time = 0; time<maxn; time++);
system("color 7");
for (time = 0; time<maxn; time++);
system("color 8");
for (time = 0; time<maxn; time++);
system("color 9");
}
}
else{
printf("\n城南以南不在蓝 城北以北不再美\n");
printf("城中从此不再挤 心中从此再无你\n南墙已撞 故事已忘\n江湖再见\n\n\n\n");
}
}