#include <iostream>
#include <string>
using std::cin;
using std::cout;
using std::endl;
int main()
{
int max;
int rows;
int spaces;
int r, c;
cout << "Enter max stars: ";
cin >> max;
spaces = max;
rows = max + max -1;
for (r = 1; r <= rows; r++) {
// For rows 1 through max, decrease the number of spaces.
// The for the rest, increase the number of spaces
if (r <= max) spaces--;
else spaces++;
// Print "spaces" space characters
for (c = 1; c <= spaces; c++)
cout << " ";
// Now continue printing "*" characters until you've reached max.
for (c = spaces + 1; c <= max; c++)
cout << "*";
// End the line.
cout << endl;
}
}