第11周项目1(2)-函数版星号图(printchs)
来源:互联网 发布:软件测试自动化书籍 编辑:程序博客网 时间:2024/06/05 22:33
问题及代码:
/**Copyright (c)2014,烟台大学计算机与控制工程学院*All rights reserved.*文件名称:star.cpp*作 者:赵敏*完成日期:2014年11月6日*版 本 号:v1.0**///调用函数printchs输出星号图#include <iostream>using namespace std;//在下面写printchs函数的定义,功能是输出一行若干个指定字符void printchs(int m,char ch){ for(int j=1;j<=m;++j) cout<<ch;}int main( ){ int n=6; //n代表要输出的行数 int i; //通过在下面的循环里调用printchs函数,输出右面的图 for(i=1; i<=n; ++i) { printchs(n-i,' '); printchs(2*i-1,'*') ; cout<<endl; } return 0;}
运行结果:
知识点总结:
对printchs函数的调用。
0 0
- 第11周项目1-函数版星号图(2)调用printchs函数
- 第11周项目1 函数版星号图(2printchs函数的调用)
- 第11周项目1(2)-函数版星号图(printchs)
- 第11周项目1(2)-printchs函数的调用(输出星号图)
- 第11周项目1-2调用函数printchs输出星号图
- 第11周项目1-4用printchs函数输出学过的星号图
- 第十一周项目1-printchs函数星号图
- 编程:函数版星号图 printchs函数
- 第11周项目2 编写printchs函数
- 第11周项目1 函数版星号图2
- 第11周项目1(2)-函数版星号图
- 第11周项目1函数星号图(2)
- 调用函数printchs输出星号图(2)
- 第11周项目1函数版星号图(1填充程序输出星号图)
- 第11周项目1-函数版星号图(4)输出以前的星号
- 第11周项目1 函数版星号图1
- 第11周项目1(1)-函数版星号图
- 第11周项目1-函数版星号图
- kmp算法
- 将博客搬至chinaunix
- jquery判断元素是否隐藏
- StringUtils常用方法+StringUtils详细介绍
- 第11周项目1函数版星号图(1)
- 第11周项目1(2)-函数版星号图(printchs)
- 编程:函数版星号图
- 动态规划--HDU--1024
- 第十一周项目1-函数版星号图2
- 第11周项目2-求最大公约数(1)
- Adapter 适配器模式
- 第11周项目1(2)-三角形星号图
- asp.net-母版页实用测试
- 5个简单方式使用strace场景