QUOTE(fero4u123 @ 3 Nov, 2006 - 04:30 PM)

//now my problem is when i run this program it is suppose to print out //a triangle with the height of what the user entered and the //characters should be decreasing by 2. So if i ran the program and i //put the number 5 for the height i want it to print out something like //this
// *********
// *******
// *****
// ***
// *
//can someone please help me with this ?
im sorry but the triangle at the bottom is suppose to look like a upsidedown pyramid but i cant get it to come out right
CODE
void triangle (int height)
{ for(int row =1; row <=height; row++)
{textcolor(row);
for(int blanks=0; blanks <= row; blanks++)
cprintf(" ");
for(int star=height; star>= row*2-1; star--)
cprintf("*");
cout << "\n";
}
}
You code is a bit of a C++ and C blend, and I believe that you need to spend a little more time with pen and paper to map out the algorithm. Some improvement can be made by using all C++ ( that is iostreams).
Have you considered the following from iostream/iomanip:
They will definitely make this work much better