- /*
- *Copyright (c)2014,烟台大学计算机与控制工程学院
- *All rights reserved.
- *文件名称:blood.cpp
- *作 者:吴英政
- *完成日期:2014年10月6日
- *版 本 号:v1.0
- *
- *问题描述: 根据main函数中对printchs函数的调用,编写printchs函数的星号图
- *程序输出: 无
- *程序输入:输出星号图
#include <iostream> //调用函数printchs输出星号图 using namespace std; //在下面写printchs函数的定义,功能是输出一行诺干个指定字符 void printchs(int m,char h) { for (int j=1;j<=m;++j) cout<<h; } int main() { int n=6; //n代表要输出的行数 int i; //通过在下面的循环里调用printchs函数,输出星号图 for(int i=1;i<=n;++i) { printchs(n-i,' '); printchs(2*i-1,'*'); cout<<endl; } return 0; }
总结:感觉不会英语好无奈啊,没有认真学函数真的是错误啊