问题及代码:
/*
*copyright (c) 2014,烟台大学计算机学院
*All rights reserved.
*文件名称:test.cpp
*作 者:李一波
*完成日期:2016年3月15号
*版 本 号:v1.0
*
*问题描述:
*输入描述:
*程序输出:
*/
#include <iostream>
using namespace std;
int main()
{
int i,j;
for(i=1;i<=6;i++)
{
for(j=1;j<=11;j++)
{
if(j<=6-i||j>=6+i)
cout<<" ";
else
cout<<"*";
}
cout<<endl;
}
for(i=1;i<=5;i++)
{
for(j=1;j<=11;j++)
{
if(j<=i||j>=12-i)
cout<<" ";
else
cout<<"*";
}
cout<<endl;
}
return 0;
}
运行结果: