命名规则
比较著名的命名规则当推 Microsoft 公司的“匈牙利”法,该命名规则的主要思想是 “在变量和函数名中加入前缀以增进人们对程序的理解 ”。例如所有的字符变量均以 ch 为前缀,若是指针变量则追加前缀 p。如果一个变量由 ppch 开头,则表明它是指向字符 指针的指针。
1 #include <iostream> 2 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 4 using namespace std; 5 int main(int argc, char** argv) { 6 //声明变量语句中使用顺序运算 7 int x, y; 8 9 //计算中使用顺序运算 10 x=50; 11 y=(x=x-5, x/5); 12 cout<<"x="<<x<<endl; 13 cout<<"y="<<y<<endl; 14 return 0; 15 }