Showing posts with label Heart Image Generator in C. Show all posts
Showing posts with label Heart Image Generator in C. Show all posts

Saturday, August 10, 2019

Heart Image Generator in C

A simple heart image generator program in C that I wrote a long time ago in my free time.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing

heart.c

#include <stdio.h>
#include<conio.h>
#include <math.h>
int main()
{
int x, y, size;
printf("How big is your heart?\n");
scanf("%d", &size);
for (x=0; x<size; x++)
{
for (y=0; y<=4*size; y++)
{
double dist1 = sqrt( pow(x-size,2) + pow(y-size,2) );
double dist2 = sqrt( pow(x-size,2) + pow(y-3*size,2) );
if (dist1 < size + 0.5 || dist2 < size + 0.5 )
printf("%c",86);
else
printf(" ");
}
printf("\n");
}
for (x = 1; x <= 2*size; x++)
{
for (y=0; y<x; y++)
printf(" ");
for (y=0; y<4*size + 1 - 2*x; y++)
printf("%c",86);
printf("\n");
}
getch();
return 0;
}