打印下列菱形图案
#include<iostream>
using namespace std;
int main()
{
int k = 6,l=1;
for (int i = 0;i < 4;i++) { //进行前四行输出
for (int j = 0;j < k;j++) { //进行每行的空格输出
cout << " ";
}
for (int b = 0;b < l;b++) { //进行每行的*输出
cout << "* ";
}
k -= 2;l += 2;
10
cout << endl;
}
int e=2, f=5;
for (int a = 0;a < 3;a++) { //进行后三行输出
for (int c = 0;c < e;c++) { //进行每行的空格输出
cout << " ";
}
for (int d = 0;d < f;d++) { //进行每行的*输出
cout << "* ";
}
f -= 2;e += 2;
cout << endl;
}
return 0;
}