002: Character diamond

Total time limit: 

1000ms
 
Memory Limit: 
65536kB
description

Given a character, it is configured with a diagonal length of 5 characters, tilted diamond.

Entry
Enter only one line containing a character.
Export
The character made of diamond.
Sample input
*
Sample Output
  *
 ***
*****
 ***
  *

 1 #include <iostream>
 2 using namespace std;
 3 /*
 4   *
 5  ***
 6 *****
 7  ***
 8   *
 9 */
10 int main(){
11     char c;
12     cin>>c;
13     cout<<"  "<<c<<"\n";
14     cout<<" "<<c<<c<<c<<"\n";
15     cout<<c<<c<<c<<c<<c<<"\n";
16     cout<<" "<<c<<c<<c<<"\n";
17     cout<<"  "<<c;
18     
19     
20     return 0;
21 }

 

Guess you like

Origin www.cnblogs.com/geyang/p/12329693.html