http://ybt.ssoier.cn:8088/problem_show.php?pid=1004

1004:字符三角形

时间限制: 1000 ms         内存限制: 66536 KB

【题目描述】

给定一个字符,用它构造一个底边长5个字符,高3个字符的等腰字符三角形。

【输入】

输入只有一行,包含一个字符。

【输出】

该字符构成的等腰三角形,底边长5个字符,高3个字符。

【输入样例】

*

【输出样例】

  *
 ***
*****

#include <iostream>
using namespace std;
int main()
{
char ch;
cin>>ch;
cout<<" "<<" "<<ch<<endl;
cout<<" "<<ch<<ch<<ch<<endl;
cout<<ch<<ch<<ch<<ch<<ch<<endl;
return 0;
}

posted @ 2022-05-30 19:15  大男孩吖  阅读(187)  评论(0)    收藏  举报