Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: How to print heart with your lover name in C++
Description: I have developed this beautifull application in DevC++. In this application you can print heart with your lover name .

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


1|P ag e

C++ How to print heart with your lover name source code 100 % working
Source code:
/**
* C++ program to print heart star pattern with center of your lover name
*/

#include ...
h>

int main()
{
int i, j, n;
char name[50];
int len;

// prompt to the user

printf("Enter your name: ");
gets(name);

printf("Enter value of n : ");
scanf("%d", &n);

len = strlen(name);

// Print upper part of the heart shape
for(i=n/2; i<=n; i+=2)

2|P ag e

{
for(j=1; j{
printf(" ");
}

for(j=1; j<=i; j++)
{
printf("*");
}

for(j=1; j<=n-i; j++)
{
printf(" ");
}

for(j=1; j<=i; j++)
{
printf("*");
}

printf("\n");
}

// Prints lower triangular part of the pattern
for(i=n; i>=1; i--)
{

3|P ag e

for(j=i; j{
printf(" ");
}

// Print the name
if(i == n)
{
for(j=1; j<=(n * 2-len)/2; j++)
{
printf("*");
}

printf("%s", name);

for(j=1; j<(n*2-len)/2; j++)
{
printf("*");
}
}
else
{
for(j=1; j<=(i*2)-1; j++)
{
printf("*");
}
}

4|P ag e

printf("\n");
}

printf("\n"); printf("\n");
printf("

###### By Hafiz Muhammad Umar Hayat ###### ");

return 0;
}

Output:

BY Hafiz Muhammad Umar Hayat


Title: How to print heart with your lover name in C++
Description: I have developed this beautifull application in DevC++. In this application you can print heart with your lover name .