帮我写一个动态爱心代码
时间: 2023-04-03 07:00:50 浏览: 72
动态爱心代码
好的,以下是动态爱心代码:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
int i, j;
int x, y;
double f;
char a[80][80] = { ' ' };
system("mode con cols=80 lines=40");
system("color c");
x = 40;
y = 20;
for (i = ; i < 100; i++)
{
f = (i % 360) * 3.1415926 / 180;
a[(int)(y - 5 * (1.2*sin(f) - sin(2 * f)))][(int)(x + 10 * (1.2*cos(f) - cos(2 * f)))] = '*';
a[(int)(y - 5 * (1.2*sin(f) - sin(2 * f)))][(int)(x + 10 * (1.2*cos(f) + cos(2 * f)))] = '*';
a[(int)(y - 5 * (1.2*sin(f) + sin(2 * f)))][(int)(x + 10 * (1.2*cos(f) - cos(2 * f)))] = '*';
a[(int)(y - 5 * (1.2*sin(f) + sin(2 * f)))][(int)(x + 10 * (1.2*cos(f) + cos(2 * f)))] = '*';
system("cls");
for (j = ; j < 40; j++)
{
printf("%s\n", a[j]);
}
Sleep(50);
for (j = ; j < 80; j++)
{
for (int k = ; k < 80; k++)
{
a[j][k] = ' ';
}
}
}
return ;
}
阅读全文