谁说程序猿就一定不解风情,今天就给大家分享一个C++绘制的心形图案,送给你的TA吧
#include <stdio.h>
void main()
{
int i, j, k, l, m; char c=3;
for (i=1; i<=5; i++) printf("\n");
for (i=1; i<=3; i++)
{
for (j=1; j<=32-2*i; j++) printf(" ");
for (k=1; k<=4*i+1; k++) printf("%c", c);
for (l=1; l<=13-4*i; l++) printf(" ");
for (m=1; m<=4*i+1; m++) printf("%c", c);
printf("\n");
}
for (i=1; i<=3; i++)
{
for (j=1; j<=24+1; j++) printf(" ");
for (k=1; k<=29; k++) printf("%c", c);
printf("\n");
}
for (i=7; i>=1; i--)
{
for (j=1; j<=40-2*i; j++) printf(" ");
for (k=1; k<=4*i-1; k++) printf("%c", c);
printf("\n");
}
for (i=1; i<=39; i++) printf(" ");
printf("%c\n", c);
for (i=1; i<=4; i++) printf("\n");
}
以上就是本文关于C绘制心形的全部内容了,希望大家能够喜欢。