1.代码1
#include<stdio.h>
#include<string.h>
#include<windows.h>
#define _CRT_SECURE_NO_WARNINGS 1
void love()
{
system("color 4");
printf(" **** ***************** ** ** ** * * * * * * * * * * \n");
printf(" * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * ** ** ** \n");
printf(" * * * ******* * ** ** ** \n");
printf(" * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * ******* * ** ** ** \n");
printf(" * * * * ** ** ** \n");
printf(" * * * * * * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * * * * * * ***************** **** ** * * * * * * * * * * \n");
}
int main()
{
int num = 5;
double n = 0;
char arr1[] = "i miss you";
printf("%s\n", arr1);
char arr2[] = "love";
do
{
printf("请输入:");
scanf("%lf", &n);
if (n != (double)6.21)
{
printf("提示:和生日有关\n");
printf("输入错误,请重新输入:");
printf("还有%d次机会\n",num);
}
if ((double)n == 6.21)
{
int ret = 5;
system("cls");
system("color 4");
memcpy(arr1 + 2, arr2, 4);
printf("%s\n", arr1);
printf("520 520 520\n");
double i = 0;
do
{
printf("请输入:");
scanf("%lf", &i);
if (n != (double)4.84)
{
printf("提示:和生日有关\n");
printf("输入错误,请重新输入:");
printf("还有%d次机会\n", ret);
}
if (i == (double)4.84)
{
love();
printf("我喜欢你,可以做我的小朋友吗?\a\n");
printf("我喜欢你,可以做我的小朋友吗?\a\n");
printf("我喜欢你,可以做我的小朋友吗?\a\n");
printf("我喜欢你,可以做我的小朋友吗?\a\n");
printf("我喜欢你,可以做我的小朋友吗?\a\n");
}
} while (ret--);
}
} while (num--);
return 0;
}
在这个代码中我们需要两个生日作为密码。在输入错误时会提示和生日有关,第一次输入正确,i mess you 就会变为i love you ,再次输入正确就会出现love。代码也有很多值得改进的地方,大家也可以尝试尝试。
2.代码2(也就是上次的表白代码)
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
#include<windows.h>
#include<stdlib.h>
void test1()
{
float n = 0;
int count = 5;
while (count)
{
printf("\n你还有%d次机会\n", count);
printf("请输入密码:");
scanf("%f", &n);
if (n == (float)6.21)
{
printf("恭喜你答对了。\n");
if (n == (float)6.21)
{
for (int i = 0; i <= 20; i++)
{
printf("520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 520 ");
printf("\n");
system("color 4");
Sleep(300);
while (i >= 20 && i < 22)
{
printf("山有木兮木有枝,心悦君兮君不知。本是青灯不归客,却因浊酒恋红尘。\n");
printf("幸得识卿桃花面,从此阡陌暖春。\n");
printf("山河远阔,人间星河,无一是你,无一不是你 。\n ");
printf("何须浅碧深红色,自是花中第一流。\n");
printf("不得语,暗相恩。两心之外无人知。\n");
printf("衣带渐宽终不悔,为伊消得人憔悴。\n");
printf("礼花一现映花红,百艳凋零夜削彤\n");
printf("情约万星追月时,奈何无缘浅随空\n");
printf("人生若只如初见,当时只道是寻常\n");
printf("暗恋就像折翼的萤火虫、天边最暗的星、被踩灭在炭堆中的火星,于你看不见的地方悄然发光。藏于卑微,在懦弱中挣扎。\n");
printf("暗恋就是靠近他一点点都会脸红心跳加速却不敢说一句话。\n");
printf("许久的暗恋,短暂的爱情,爱你是我年少时最荒唐的认真。\n");
printf("一段念念不忘的暗恋,最终会在某天被某种天气结束,如一场没有预告的大雨,或者一次戛然而止的哭泣。\n");
printf("我既然选择了喜欢你,哪能那么轻易的放弃,但如果那天我真的放弃了,请你记得那是因为你的不在乎。\a\n");
printf("我曾喜欢过你但我和你未曾在一起。\a\n");
i++;
system("color 4");
Sleep(3000);
printf("\n");
printf("\n");
printf("\n");
printf("\n");
}
while (i >= 22 && i < 23)
{
printf("喜欢小陈的一句话:\n");
printf("我的一切付出都是心甘情愿,对此我绝口不提。你若投桃报李,我会十分感激,你若无动于衷,我也不会灰心丧");
printf("直到有一天,我不愿这般爱你,那就让我们一别两宽,各生欢喜\n");
printf("深情但不纠缠,这就是爱情里最好的心态,我做好了跟你过一辈子的打算,也做好了你随时要走的淮备。\n");
printf("你不是我权衡利弊后的选择,而是我怦然心动。后明知不可为而为之的坚定,我是爱你的,但你,是自由的\n");
printf("一生所求,不过温暖与良人。愿你我皆有,岁月可回首,且以深情共白头\n");
i++;
system("color 4");
Sleep(5000);
printf("\n");
printf("\n");
printf("\n");
printf("\n");
}
while (i >= 22 && i <= 25)
{
printf(" **** ***************** ** ** ** * * * * * * * * * * \n");
printf(" * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * ** ** ** \n");
printf(" * * * ******* * ** ** ** \n");
printf(" * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * ******** * ** ** ** \n");
printf(" * * * * ** ** ** \n");
printf(" * * * * * * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * * * * * * ***************** **** ** * * * * * * * * * * \n");
system("color 4");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
i++;
Sleep(2000);
char arr1[] = "i don't want to miss you ";
char arr2[] = "#########################";
int i = 0;
int r = strlen(arr1) - 1;
while (i <= r)
{
arr2[i] = arr1[i];
arr2[r] = arr1[r];
printf("%s\n", arr2);
Sleep(1000);
system("cls");
i++;
r--;
system("color 4");
}
printf("猜到了吗?我喜欢你\a\n");
printf(" **** ***************** ** ** ** * * * * * * * * * * \n");
printf(" * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * ** ** ** \n");
printf(" * * * ******* * ** ** ** \n");
printf(" * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * ******** * ** ** ** \n");
printf(" * * * * ** ** ** \n");
printf(" * * * * * * * * * * * ** ** ** * * * * * * * * * * \n");
printf(" * * * * * * * * * ***************** **** ** * * * * * * * * * * \n");
printf("\n");
printf("\n");
printf("\n");
printf("做我女朋友好吗?\a\n");
system("color 4");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
printf("\n");
break;
}
}
}
break;
}
if (n != (float)6.21)
{
printf("答错了,再想想**\n");
}
count--;
}
}
int main()
{
int n = 0;
int r = 5;
do
{
printf("小陈请输入1哟:");
scanf("%d", &n);
switch (n)
{
case 1:
test1();
break;
case 0:
printf("退出\n");
}
r--;
} while (r);
return 0;
}
感兴趣的可以试着创新一下。