Skip to content

Instantly share code, notes, and snippets.

@techlarry
Created November 11, 2017 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techlarry/57cd9d85bcfe24c0d621a9e28a538772 to your computer and use it in GitHub Desktop.
Save techlarry/57cd9d85bcfe24c0d621a9e28a538772 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
char a;
cin >> a;
for(int i =1; i<=3;i++){
for (int j=1; j<4-i;j++)
cout << " ";
for (int j=1; j<=2*i-1; j++)
cout << a;
cout << '\n';
}
for(int i =2; i>=1;i--){
for (int j=1; j<4-i;j++)
cout << " ";
for (int j=1; j<=2*i-1; j++)
cout << a;
cout << '\n';
}
}
2:字符菱形
总时间限制: 1000ms 内存限制: 65536kB
描述
给定一个字符,用它构造一个对角线长5个字符,倾斜放置的菱形。
输入
输入只有一行, 包含一个字符。
输出
该字符构成的菱形。
样例输入
*
样例输出
*
***
*****
***
*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment