how could i make a triangle thatgot spaces/hole at it's centre.. :
for example like this :
---------------- *
--------------*----*
------------*--------*
----------*------------*
---------***********
-->> which the "------" is actually the space...
i've tried working with this code but its not working :( :
#include <iostream>
using namespace std;
int main ()
{
int a,b;
for (a=1; a<=10; a++)
{
for (b=1; b<=10-a; b++){
cout<<" ";
}
for (b=1; b<=2*a-1; b++){
if(b%2==0){
cout<<"*";
}else cout<<" ";
}
cout<<endl;
}
system("pause");
}
what changes do i need to make this code working like what i desired??
Thank You for helping....