中文关键字编程

vs2010, vs2013可以用中文变量名中文函数名中文类型别名

vc6不支持, vs2003, vs2005, vs2008没实验.

用途可以配合宏的使用C++语言伪装或模拟成另外一种语言的语法


// ClassroomExamples_vs2010.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include 
#include 
#include 

using namespace std;

void clear_cin();
void 方法_测试中文语法(); ///< 测试中文语法

int _tmain(int argc, _TCHAR* argv[])
{
    setlocale(LC_ALL, ".936");

    方法_测试中文语法();
    cout << "END, press any key to quit" << endl;
    clear_cin();
    getchar();

    return 0;
}

void 方法_测试中文语法()
{
    typedef int 整形类型;
    typedef float 浮点类型;

    整形类型 整形变量_test = 100;
    浮点类型 浮点变量_Test = 3;

    整形变量_test += 3;
    浮点变量_Test -= 2;

    cout << "整形变量_test = " << 整形变量_test << endl
        << "浮点变量_Test = " << 浮点变量_Test << endl;

    /** run result
    整形变量_test = 103
    浮点变量_Test = 1
    */
}

void clear_cin()
{
    cin.clear();
    cin.sync();
}


你可能感兴趣的:(c++)