Code小男孩


私信TA

用户名:1871925501

访问量:1039

签 名:

#include<bits/stdc++.h>

等  级
排  名 3783
经  验 1769
参赛次数 0
文章发表 9
年  龄 0
在职情况 学生
学  校 上海理工大学
专  业

  自我简介:

解题思路:    都在代码里了

注意事项:    一定要看清楚前面还有几个空格!!

参考代码:

#include<iostream>

using namespace std;

int main(void)

{

int n,m;

cin>>n>>m;

int Std=n;

int STK=1,STG=2*Std-1;

for(int i=0;i<n;i++)

{

for(int t=0;t<m;t++) //图形前面还有几个空格,我吐了 

{

cout<<" ";

}

for(int j=0;j<n-1-i;j++)

{

cout<<" ";

}

for(int k=STK,g=STG;k<=2*Std-1,g>=1;) // for()循环里面可以放多个变量 

{

for(int f=1;f<=k;f++)

{

cout<<"*";

}

for(int u=0;u<m;u++)

{

cout<<" ";

}

for(int p=1;p<=g;p++)

{

cout<<"*";

}

if(i<n-1)

cout<<endl;

STK+=2;

STG-=2;

break;

}

}

return 0;

 } 


 

0.0分

0 人评分

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

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区