setw устанавливает ширину для следующей операции, а не всю строку.Таким образом, ширина одиночного cout << fill установлена в значение.Это дает вам заполнение, но вам нужно установить setw в 0 для последней строки. </p>
также, кажется, есть некоторая избыточная попытка кода:
int main()
{
int topw, height, width, rowCount = 0, temp;
char fill;
cout << "Please type in the top width: ";
cin >> topw;
cout << "Please type in the height: ";
cin >> height;
cout << "Please type in the character: ";
cin >> fill;
width = height;
cout<<setw(width);
temp = topw;
while(rowCount < height)
{
cout<<setw(width);
for(int i = 0; i < temp; i++)
{
cout << fill;
}
cout << endl;
rowCount++;
width--;
temp = temp +2;
}
}