Easy Tutorial
❮ C Goto Statement C Examples Int Data Compare ❯

C Practice Example 7

C Language Classic 100 Examples

Title: Output a special pattern. Please run this in a C environment to see how very beautiful it is!

Program Analysis: There are 256 characters in total. Different characters produce different patterns.

Chinese characters appear garbled in VC6.0 (reasons and solutions):

176 in hexadecimal is B0, 219 in hexadecimal is DB, and 0xB0DB is the internal code for the character "佰", so the output is "佰".

The main reason is the difference in file information code pages. The code page for the Chinese operating system needs to display extended ASCII codes under 437 OEM-US to show what you want. The steps to modify the default code page of the console are as follows:

Example

//  Created by www.tutorialpro.org on 15/11/9.
//  Copyright © 2015 tutorialpro.org. 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;
}

The above example output is:

C Language Classic 100 Examples

❮ C Goto Statement C Examples Int Data Compare ❯