Home > C++ > Print Filled diamon or un Filled Diamon

Print Filled diamon or un Filled Diamon

#include

using namespace std;

void pFilledDimon(int size);
void pUnFilledDimon(int size);

void pWhiteSpace(int num); // print the white space , by amount of num
void pStar(int num); // print the * , by amount of num
void pSW(int num);

int main(int argc, char *argv[])
{
int choice;
system(“cls”);
cout << "Enter the number for Filled Dimon or UnFilled Dimon (1 or 2) : " ; cin >> choice ;
cout << endl; if (choice == 1) { pFilledDimon(25); } else { pUnFilledDimon(25); } cout << endl; cout << "Thank you for using me ! " << endl; system("PAUSE"); return EXIT_SUCCESS; } void pFilledDimon(int size) { int middle = size / 2; int j = middle; for (int i=0; i 1)
{
whitenum = num – 2;
cout << "*"; pWhiteSpace(whitenum); pWhiteSpace(whitenum+1); cout << "*"; } } [/sourcecode] This is just another exercise. using fuction and algorithm to print the dimon shap with "*" , and display filled and unfilled dimon indentify by user.

Categories: C++
  1. steerapong
    July 7, 2008 at 6:17 am

    This exercise show how to use function to display “*” or white space according to parameters of function

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: