使用字符 176(淺塊)和 219(深塊)組合打印 5x5 圖案,展示擴展 ASCII 字符視覺效果。
// Created by www.runoob.com on 15/11/9.
// Copyright © 2015年 菜鳥教程. All rights reserved.
//
#include <stdio.h>
int main() {
char a = 176, b = 219;
printf("%c%c%c%c%c\n", b, a, a, a, b);
printf("%c%c%c%c%c\n", a, b, a, b, a);
printf("%c%c%c%c%c\n", a, a, b, a, a);
printf("%c%c%c%c%c\n", a, b, a, b, a);
printf("%c%c%c%c%c\n", b, a, a, a, b);
return 0;
}
對稱圖案(見原文圖片),中心為深塊,四角深塊,其餘淺塊交替。
VC6.0 中文環境下 176(B0) 和 219(DB) 組合被解釋為雙字節中文字符「佰」。解決:控制台代碼頁改為 437 (OEM-US),或使用 Unicode 字符。