GBK汉字输出
int main()
{
printf("%c%c", 0x81, 0x40);
printf("\n");
int count = 0;
for (int i = 0x81;i <= 0xFE;i++) {
for (int j = 0x40; j < 0xFE; j++)
{
printf("%c%c - ", i, j);
count++;
if (count >= 20) {
count = 0;
printf("\n");
}
}
}
char a[3] = { i,j,'\0' };
if ((string)a == "你" || (string)a == "们" || (string)a == "好" || (string)a == "吗") {
printf("%s", a);
}
const char testStr[] = "你们好吗";
int index = 0;
while (testStr[index] != '\0')
{
cout << 256 + (int)testStr[index] << endl;
index++;
}
区分中英文
char* strText = (char*)malloc(60);
//const char * strText = "你a们kkk,好吗?";
cin >> strText;
printf("%d \n", strlen(strText));
while (*strText!='\0')
{
if (isascii(*strText)) {
printf("---1---%c \n", *strText);
strText++;
}
else
{
int firstSign = 256 + (*strText);
int secondSign = 256 + (*++strText);
printf("------%c%c \n", firstSign, secondSign);
strText++;
}
}
测试打印