看板 civil92 關於我們 聯絡資訊
#include<iostream> using namespace std; int main() { int i ; cout<<"Please input a odd number:"; cin>>i; int a=1,b=1; do{ do{ if(a==b||a==i-b+1) cout<<char ('a'+b-1); else if (a>b && a<i-b+1) cout<<"*"; else cout<<" "; a++; }while (a<= i) ; a=1; b++ ; cout<<endl; }while (b<=i/2) ; do{ do{ if(a==b||a==i-b+1) cout<<char ('a'+b-1); else if (a<b && a>i-b+1) cout<<"*"; else cout<<" "; a++; }while (a<= i) ; a=1; b++ ; cout<<endl; }while (b>i/2&&b<=i) ; return 0; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.12.167