怎么样利用C++语言编程一个程序输出一个爱心图形
展开全部
#include <stdio.h>
void heart() {
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");
}
int main() {
heart();
void heart() {
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");
}
int main() {
heart();
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
引用迎轩彤蓓hq的回答:
#include <stdio.h>
void heart() {
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");
}
int main() {
heart();
#include <stdio.h>
void heart() {
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");
}
int main() {
heart();
展开全部
#include<stdio.h>
#include<iostream>
using namespace std;
# define U 0.06
# define V 0.025
# define M 1.1
# define N 1.2
int main()
{
float x, y;
float m, n;
for ( y=2; y>=-2; y-=U )
{
for ( x=-1.2; x<=1.2; x+=V)
{
if ( ( ( (x*x + y*y - 1)*(x*x + y*y - 1)*(x*x + y*y - 1) - x*x*y*y*y ) <= 0 ) )
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
#include<iostream>
using namespace std;
# define U 0.06
# define V 0.025
# define M 1.1
# define N 1.2
int main()
{
float x, y;
float m, n;
for ( y=2; y>=-2; y-=U )
{
for ( x=-1.2; x<=1.2; x+=V)
{
if ( ( ( (x*x + y*y - 1)*(x*x + y*y - 1)*(x*x + y*y - 1) - x*x*y*y*y ) <= 0 ) )
printf("*");
else
printf(" ");
}
printf("\n");
}
return 0;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询