函数版星号图
来源:互联网 发布:大宗商品期货软件 编辑:程序博客网 时间:2024/05/17 09:09
题目来源: 函数版星号图
这一组的练习意在通过调用函数输出星号图,体会与理解函数的工作过程,并为其后编制自定义函数实现特定功能。
#include <iostream>using namespace std;void printX(int m,char c){for(int i = 1;i <= m;i++){cout << c;}}void main(){int n = 6; // the number of linefor(int i = 1; i <= 6;i++){printX(n - i,' ');printX(2 * i - 1,'*');cout << endl;}for(int i = 1; i <= 6;i++){printX(n - i,' ');printX(2 * i - 1,'A'+i-1);cout << endl;}system("pause");}
从实验结果看来,感觉确实很巧妙,从第一个星号图到第二个字母图,很有意思的变化~~~感谢提供参考的博主!
0 0
- 函数版星号图
- 函数版星号图
- 函数版星号图
- 函数版星号图
- 函数版星号图
- 星号图函数版2
- 星号图函数声明版
- 编程:函数版星号图
- 函数版星号图二
- 函数版星号图2
- 函数版星号图1
- 编程:函数版星号图 printchs函数
- 星号图函数版1
- 1-11-1 - 函数版星号图
- 编程:函数版星号图 输出字母
- 第十一周函数版星号图3
- 函数版星号图(1)
- 第十一周项目-函数版星号图
- android IPC_service
- Android 开发之旅:view的几种布局方式及实践
- 第12周项目 3.1 递归 阶乘
- 第十四周 项目3.1 多科成绩处理
- 人品计算器
- 函数版星号图
- PHP 上传文件大小限制
- 第14周 项目2-带姓名的名单(2)
- 选择屏幕按钮
- 第十三周项目5——将两个字符串连接仍保存到第一个字符串中
- ArcGis Server queryTask返回数据的geometry为空
- java注解应用实例 - Annotation, 自定义注解, 注解类规则
- 第十四周 项目3.2 多科成绩处理
- android清楚本地数据缓存代码