Submission
Status:
-----
Subtask/Task Score:
0/100
Score: 0
User: porpeang
Problemset: กังหันสี่ทิศ
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-02 13:53:45
#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,e,f,g,j;
cin>>a;
string abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int i = a; i >= 1; i--) {
// --- รูปที่ 1: ตัวอักษร ---
for (int j = 1; j <= a - i; j++) cout << " "; // 1. เว้นหน้า
cout << abc[i - 1]; // 2. ตัวแรก
for (int j = 1; j <= (2 * i) - 3; j++) cout << " "; // 3. เว้นกลาง
if (i > 1) cout << abc[i - 1]; // 4. ตัวหลัง
cout << " "; // ช่องว่างกั้นระหว่างสองรูป
// --- รูปที่ 2: ดาว (*) ---
for (int j = 1; j <= a - i; j++) cout << " "; // 1. เว้นหน้า
cout << "*"; // 2. ตัวแรก
for (int j = 1; j <= (2 * i) - 3; j++) cout << " "; // 3. เว้นกลาง
if (i > 1) cout << "*"; // 4. ตัวหลัง
cout << "\n"; // ขึ้นบรรทัดใหม่
}
return 0;
}