/*
Copyright(C)2013,烟台大学计算机学院
All rights reserved.
文件名称:test.cpp
作者:李东奇
完成日期:2013年11月05日
版本号:v1.0
输入描述:输入星号图
问题描述:输出星号图
程序输出:见图
*/
#include <iostream>
using namespace std;
void printchs(int,char);
int main()
{
int i;
for(i=1; i<10; ++i)
{
printchs(10-i,' ');
printchs(2*i-1,'*');
cout<<endl;
}
return 0;
}
void printchs(int m,char ch)
{
for(int j=1; j<=m; ++j)
cout<<ch;
}
输出金字塔星号图(运用调用函数)
最新推荐文章于 2023-12-22 23:09:25 发布