The difference between the solutions for problems 7 and 8 is highlighted below:
for (int row = 1; row <= 7; row++)
{
for (int space = 7 - row; space > 0; space--)
cout << ' ';
for (int col = 1; col <= row; col++)
cout << row;
cout << endl;
}