解题思路: 都在代码里了
注意事项: 一定要看清楚前面还有几个空格!!
参考代码:
#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 人评分
C二级辅导-公约公倍 (C语言代码)浏览:823 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:683 |
C二级辅导-温度转换 (C语言代码)浏览:2343 |
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:487 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:730 |
【回文数(二)】 (C++代码)浏览:873 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:801 |
弟弟的作业 (C++代码)浏览:1304 |
九宫重排 (C++代码)浏览:2160 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:572 |