第十一周项目一 函数版星号图(3)

来源:互联网 发布:网络语8000是什么意思 编辑:程序博客网 时间:2024/06/05 17:47

问题及代码:

/** Copyright (c) 2014, 烟台大学计算机学院* All rights reserved.* 文件名称:Project.cpp* 作    者:chenqin31.* 完成日期:2014年11月06日* 版 本 号:v1.0** 问题描述:根据main函数中对printchs函数的调用,以及printchs的功能要求,编写printchs函数。* 程序输入:* 程序输出:*/#include <iostream>using namespace std;void printchs(int m,char ch){    for (int j=1; j<=m; ++j)        cout<<ch;}int main( ){    int n=6;    int i;    for(i=1; i<=n; ++i)    {        printchs(n-i,' ');        printchs(2*i-1,64+i) ;        cout<<endl;    }    return 0;}

运行结果:

知识点总结:学会了对printchs函数的调用

学习心得:慢慢的,总有进步。

0 0
原创粉丝点击