1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <iostream>
using namespace std;
void diamond_line(int spaces, int pluses)
{
for(int s = 0; s < spaces; s++)
cout << " ";
for(int p = 0; p < pluses; p++)
cout << "+";
cout << endl;
}
int main()
{
diamond_line(9, 2);
diamond_line(8, 4);
diamond_line(7, 6);
diamond_line(6, 8);
diamond_line(5, 10);
diamond_line(4, 12);
diamond_line(3, 14);
diamond_line(2, 16);
diamond_line(1, 18);
diamond_line(0, 20);
diamond_line(0, 20);
diamond_line(1, 18);
diamond_line(2, 16);
diamond_line(3, 14);
diamond_line(4, 12);
diamond_line(5, 10);
diamond_line(6, 8);
diamond_line(7, 6);
diamond_line(8, 4);
diamond_line(9, 2);
return 0;
}
|