C++ Program that accept the height of Philippine FLAG and display the flag!

#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int n, i, j;
cout<< " Input the Height of the Flag of the Philippine! \n";
cout<< " Input only ODD number for height!!! \n";
cout<< "If the height is EVEN it will increase by 1 !\n\n";

cout<< "Height: ";
cin>> n;
if (n%2 == 0)
n = n+1;
else
n = n;
cout<< "\n\n";

for (i=1; i<=n; i++)
{
for (j=1; j<=n+2; j++)
{
if (i<=n)
{
if (i == 1 || i == n || j == 1 || j==n+2)
{
if (j<=n+2)
cout<< "*";
}
}
if (i>=2 && i<=n-1)
{
if (i>=2 && i <= n/2)
{
if (j == i && j<=n/2)
cout<< "*";
if (j >= i+1 && j<= n+1)
cout<< " ";
if (j>=2 && j <= i-1)
cout<< " ";
}
if (i==n/2+1)
{
if (j >=2 && j <= n/2)
cout<< " ";
if (j >=n/2+1 && j<= n+1)
cout<< "*";
}
if (i>= n/2+2 && i<=n-1)
{
if (j >= 2 && j<= n-i)
cout<< " ";
if (j == (n-i)+1)
cout<< "*";
if (j >= (n-i)+2 && j<= n+1)
cout<< " ";
}//end of if i>=n/2+2
}//end of i>=2 && i<=n-1
}//end of inner loop
cout<< "\n";
}//end of outer loop
getch();
return 0;
}//end
And? What do you want?
I think OP just wanted to share the code.
Maybe it was an example how you should not write your code?
Topic archived. No new replies allowed.