给大家准备了一个爱心表白代码,有需要的直接赋值拿去用吧。
#include<iostream>
#include<cmath>
#include <stdlib.h>
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");