无心小男


私信TA

用户名:uq_50395433181

访问量:1636

签 名:

等  级
排  名 1329
经  验 2867
参赛次数 0
文章发表 4
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

TA的其他文章

参考代码:

#include<iostream>
//#include<bits/stdc++.h>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<malloc.h>
using namespace std;

bool cmp(int a, int b) {
    return a > b;
}

int main() {

    int n, m;
    cin >> n >> m;
    int q = n;
    for (int i = 1; i <= n; i++) {
        for (int t = 0; t < m; t++)
            cout << " ";  //前面还有m个空格,不然会显示格式错误
        for (int k = 1; k <= n - i; k++)
            cout << " ";
        for (int j = 0; j < 2 * i - 1; j++) {
            cout << "*";
        }
        for (int t = 0; t < m; t++)
            cout << " ";
        for (int p = 1; p <= 2 * q - 1; p++) {
            cout << "*";
        }
        cout << endl;
        q--;
    }
    return 0;
}


 

0.0分

3 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

需要那么多头文件???
2021-06-29 11:19:49
  • «
  • 1
  • »