这图案怎么打出?

sweird 2007-10-18 11:14:25
//* *
// * *
// * *
// *
...全文
277 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
jsjacky1101 2007-10-19
  • 打赏
  • 举报
回复
六楼的是简单,如果行数多了,不过不实用.
qld001 2007-10-19
  • 打赏
  • 举报
回复
六楼的最简单,哈哈,推荐!!
zhouhong0801 2007-10-19
  • 打赏
  • 举报
回复
void main()
{
int n;
cout<<"enter level: ";
cin>>n;

for ( int i=n-1; i>=0 ; i-- )
{
cout<<"//";
for ( int j=n-1 ; j>i ; j-- )
{
cout<<" ";
}
cout<<"*";
for ( j=0 ; j<(2*i-1) ; j++ )
{
cout<<" ";
}
if ( i != 0 )
{
cout<<"*\n";
}
}
cout<<endl;
}
mimong_lin 2007-10-19
  • 打赏
  • 举报
回复
6楼的,不错。。。。
pyf123 2007-10-18
  • 打赏
  • 举报
回复

#include <iostream>
using namespace std;
int main()
{
for(int i=6;i>=3;--i)
{
for(int j=0;j<i;++j)
{
if(i+j==6) cout<<'*';
else cout<<' ';
}
cout<<'*'<<endl;
}
return 0;
}

改一下
pyf123 2007-10-18
  • 打赏
  • 举报
回复

#include <iostream>
using namespace std;
int main()
{
for(int i=6;i>=3;--i)
{
for(int j=0;j<=i;j++)
{
if(i==j||i+j==6) cout<<'*';
else cout<<' ';
}
cout<<endl;
}
return 0;
}
zhaohan7 2007-10-18
  • 打赏
  • 举报
回复
#include <iostream>
using namespace std;

//* *
// * *
// * *
// *
int main()
{
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < i; j++)
{
cout << " ";
}

cout << "*";

for (int k = 0; k < (5 - 2*i); k++)
{
cout << " ";
}

if (i != 3)
{
cout << "*";
}


cout << endl;
}

cout << endl;

return 0;
}
疯石头 2007-10-18
  • 打赏
  • 举报
回复
可以用for循环
Seu_why 2007-10-18
  • 打赏
  • 举报
回复
显然能
ryfdizuo 2007-10-18
  • 打赏
  • 举报
回复
//* *
// * *
// * *
// *

#include <stdlib.h>
#include <stdio.h>

int main()
{
char ch[10] = {'/', '/', ' ', ' ', ' ', ' ', ' ', ' ', ' '};

for(int i = 0; i < 4; i++)
{
ch[2+i] = '*';
ch[8-i] = '*';

puts(ch);
ch[2+i] = ' ';
ch[8-i] = ' ';
}

return 0;
}
比较简单, 哈哈...
kbh1984 2007-10-18
  • 打赏
  • 举报
回复
#include<iostream.h>
#include<iomanip.h>
void main()
{
for(int i=0;i<3;i++)
{
cout<<"//"<<setw(i+1)<<'*'<<setw(6-2*i)<<'*'<<endl;
}
cout<<"//"<<setw(4)<<'*'<<endl;
}
etomahawk 2007-10-18
  • 打赏
  • 举报
回复
#include<iostream.h>

int main(void)
{
cout<<"* *"<<endl;
cout<<" * *" <<endl;
cout<<" * *" <<endl;
cout<<" *" <<endl;

return 0;
}

哈哈

64,688

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧