what's wrong with this code? i can't create a triangle..

int rows = 10;
double cols = rows*1.5;
string s = " ";
string::size_type space = s.size();
for (int r = 0; r != rows; ++r)
{ string::size_type c = 0;
while (c != cols)
{ if (c == space - 1)
{cout<< "*";
c += space; }
else
{ if (r == rows - 1 || c == 0)
cout<< "*";
else
cout<< " ";
++c;}}
cout<<endl;}

Reply via email to