Print Problem

zcyzzz cy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<iostream>
#include<cctype>
using namespace std;
int main(){
char c;
cin >> c;
char C_tran = toupper(c);
int num = (int)(C_tran - 'A');
int i,j,k;
for(i = 0 ; i <= num ; ++i){
for(j = (num-i)*2 ; j > 0 ; --j){
cout << " ";
}
cout << (char)('A' + i);
for(k = i ; k > 0 ; --k){
cout << " " << (char)('A' + i);
}
for(j = num*2 ; j > 0 ; --j){
cout << " ";
}
cout << '\n';
}
for(i = num-1 ; i >= 0 ; --i){
for(j = (num-i)*2 ; j > 0 ; --j){
cout << " ";
}
cout << (char)('A' + i);
for(k = i ; k > 0 ; --k){
cout << " " << (char)('A' + i);
}
for(j = num*2 ; j > 0 ; --j){
cout << " ";
}
cout << '\n';
}

}
  • Title: Print Problem
  • Author: zcyzzz
  • Created at : 2024-11-03 20:50:15
  • Updated at : 2024-11-03 20:53:06
  • Link: https://rockissleeping.github.io/2024/11/03/CppTest/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Print Problem