poll wrote:
那我也提供一下剛接觸...(恕刪)
C++版
int num, center;
cout << "請輸入一個奇數:";
cin >> num;
center = num / 2 + 1;
int temp;
for (int i = 0; i < num; ++i) {
temp = i < center ? i : num - i - 1 ;
for (int j = 1; j <= num; ++j) {
if (center >= j-temp && center <= j+temp)
cout << "*";
else cout << "0";
}
cout << "\n";
}