Problems, small program- HELP!
HEY, I'm trying to print out a pattern of stars where it starts with 5 stars on the top, then 3 next line, then 1 on the last line..all centered..
IT would look like this:
*****
..***
... *
the periods you see on the second and third lines
are only to fill space in the post..not part of the program
My problem is the last star, I don't know how to get it centered without actually doing it in the cout statement..how can i do it in the loop? Here is my code...
#include<iomanip.h>
#include<stdlib.h>
main()
{ int i, j; char star='*';
for(i=5;i>=1;i=i-2)
{
for(j=1;j<=i;j++)
cout<<star;
cout<<endl<<" ";
}
system("PAUSE");
return 0;
}