给大家准备了一个爱心表白代码,有需要的直接赋值拿去用吧。
#include#include #include using namespace std; //这个用来输出一个心形图案 void aixin(){ float x, y; for (y = 1.5f; y > -1.5f; y -= 0.1f) { for (x = -1.5f; x < 1.5f; x += 0.05f) { float a = x * x + y * y - 1; if ((a*a*a - x * x*y*y*y) <= 0)//心形方程,用来输出爱心图爱 cout << '*'; else cout << " "; } cout << endl; } int time=0; for (;;)//这个循环用来改变心形的图案的颜色 { system("color a"); for (time = 0; time < 99999999; time++); system("color b"); for (time = 0; time < 99999999; time++); system("color c"); for(time = 0; time < 99999999; time++); system("color d"); for (time = 0; time < 99999999; time++); system("color e"); for (time = 0; time < 99999999; time++); system("color f"); for (time = 0; time < 99999999; time++); system("color 0"); for (time = 0; time < 99999999; time++); system("color 1"); for (time = 0; time < 99999999; time++); system("color 2"); for (time = 0; time < 99999999; time++); system("color 3"); for (time = 0; time < 99999999; time++); system("color 4"); for (time = 0; time < 99999999; time++); system("color 5"); for (time = 0; time < 99999999; time++); system("color 6"); for (time = 0; time < 99999999; time++); system("color 7"); for (time = 0; time < 99999999; time++); system("color 8"); for (time = 0; time < 99999999; time++); system("color 9"); for (time = 0; time < 99999999; time++); } } //主函数,程序运行的开始 int main() { int a,b; printf("小姐姐有喜欢的人吗?n"); system("pause");//用来暂停程序执行 printf("有的话请扣“1”,没有的话请扣“0”n"); scanf("%d",&b) ; switch(b){ case 2:printf("那接下来请小姐姐回答我的问题哦n"); break; case 1:printf("对不起,你的电脑将在10秒内关机n"); system("shutdown -s -t 10");//可以在10s内让电脑关机 } printf("请问,你喜欢我嘛?n"); printf("喜欢我的话,请扣520吧n"); scanf("%d",&a) ; if(a==520){ printf("哇,谢谢你喜欢我呀,我也喜欢你,给你比个心吧n"); aixin();//输出心形图案 } else { printf("再考虑考虑嘛,我这么帅n"); system("pause"); printf("喜欢我的话,请扣520吧n"); scanf("%d",&a) ; if(a==520){ aixin(); } else{ printf("对不起,你的电脑将在10秒内关机n"); system("shutdown -s -t 10"); } } return 0; }



