Please , I need this pattern , not solved ever !

**Hello there ...
Please , I need help with this pattern , not solved ever !
the question is ::
write a C++/C program that display this pattern ,, you should use a loop in there ...
http://im31.gulfup.com/HbYME.png
the user enter number of rows and extended !! example ::
http://im31.gulfup.com/3RXrZ.png
Thanks for everyone ,, I Still wait guys !**



Thanks guys ,, but ,, i try over and over but it's not solved ,,
i try with if , but i dont know should i do all this for every star ,, i still dont know

this is my solution with if ,,


#include <iostream.h>
void main () {

int rows,cols,n;
cin>>n;
for(rows=1; rows<=n; rows++)
{
for(cols=1; cols<=n; cols++)
if(
(rows==2 && cols!=n)
|| ((rows!=n && rows!=1) && cols==n-1)
|| ((cols!=n && cols!=1) && rows==n-1)
|| (cols==2 && (rows!=n && rows!=1 && rows!=3))
|| (rows==4 && (cols!=1 && cols!=n && cols!=n-2))
|| (cols==n-3 && (rows!=1 && rows!=n && rows!=n-2 && rows!=3))
|| (rows==n-3 && (cols!=1 && cols!=n && cols!=3 && cols!=n-2))
|| (cols==4 && (rows!=1 && rows!=n && rows!=3 && rows!=n-2 && rows !=5))
|| (cols==4 && (rows!=n && rows!=1 && rows!=3 && rows!=n-2 && rows!=5))
|| (rows==6 &&(cols!=1&&cols!=n&&cols!=3&&cols!=n-2&&cols!=n-4))
|| (cols==n-5&&(rows!=1&&rows!=n&&rows!=n-2&&rows!=n-4&&rows!=3&&rows!=5))
|| (rows==n-5&&(cols!=1&&cols!=n&&cols!=n-2&&cols!=n-4&&cols!=3&&cols!=5))
)
cout<<" ";
else
cout<<"* ";
cout<<"\n";

}

cout<<"\n\n";

}


can i translate this idea to loop ,, please give me simple help , and thanks
Last edited on
Topic archived. No new replies allowed.