#include using namespace std; void spaces(int x) { for (int c = 1; c <= x; c++) cout << " "; } void stars(int x) { for (int c = 1; c <= x; c++) cout << "*"; } void row(int r, int rows) { spaces (rows - r); stars (2); spaces (2*(r - 1)); stars (1); cout << endl; } void top_row(int rows) { spaces (rows); stars (1); cout << endl; } int main() { int r, rows; cout << "Size of diamond? "; cin >> rows; top_row(rows); for (r = 1; r <= rows; r ++) row(r, rows); for (r = rows - 1; r >= 1; r --) row (r, rows); top_row(rows); return 0; }