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. Teerapong Sontayaman's avatar
    steerapong
    07/07/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 comment