2710-输出菱形

来源:互联网 发布:昆明理工大学教育网络 编辑:程序博客网 时间:2024/06/01 22:09
#include <bits/stdc++.h>using namespace std;int main(){    int n;    while(cin >> n)    {        for(int i = 0; i < n; i++)        {            for(int j = n-i-1; j > 0; j--)            {                cout << " ";            }            for(int k = 0; k <= i; k++)            {                cout << " " <<"*";            }            cout << endl;        }        for(int i = n-1; i > 0; i--)        {            for(int j = 0; j < n - i; j++)            {                cout << " ";            }            for(int k = i; k > 0; k--)            {                cout << " " << "*";            }            cout << endl;        }    }    return 0;}
原创粉丝点击