题解 | 牛牛的字符菱形
#include<iostream> using namespace std; int main() { int b=0; char a; cin>>a; for(int i=1;i<=5;i++) { int j=i*2-1; int t=i; if(j>5) { t%=3; for(;t>0;t--) { cout<<" "; } j%=4; for(;j>0;j--) { cout<<a; } cout<<"\n"; } else { for(;t<3;t++) { cout<<" "; } for(;j>0;j--) { cout<<a; } cout<<"\n"; } } system("pause"); return 0; }
奇怪,这道题为什么要用这么复杂的解法