半城烟沙

导航

2010年4月19日

朝花夕拾之C++篇:C++运算符优先级

摘要: http://www.cppreference.com/operator_precedence.html PrecedenceOperatorDescriptionExampleAssociativity1()[]->.::++--Grouping operatorArray accessMember access from a pointerMember access from an ob... 阅读全文

posted @ 2010-04-19 18:24 半城烟沙 阅读(156) 评论(0) 推荐(0) 编辑

朝花夕拾之C++篇(二)全局变量&局部变量

摘要: 全局变量即在函数外声明的变量,局部变量即在函数内部声明的变量,例如: #include<iostream.h> float num=3.14;//一个名为num的全局变量 void main() { float num=2.45;//一个名为num的局部变量  cout<<num<<endl; count<<::num<<endl; } ... 阅读全文

posted @ 2010-04-19 18:11 半城烟沙 阅读(250) 评论(1) 推荐(0) 编辑

朝花夕拾之C++篇(一)C++运算符

摘要: 基本运算符——+:加—:减*:乘/:除%:取模(求余数)逻辑运算符——!:逻辑非;&&:逻辑与;例:x && y,x、y都为真才真,否则假;x=3,y=4,z=x&&y,则z=1||:逻辑或;例:x|| y,x、y都为假才假,否则真~:逐位求反;&:逐位求与;^:逐位求异或;异或运算... 阅读全文

posted @ 2010-04-19 17:31 半城烟沙 阅读(1500) 评论(0) 推荐(0) 编辑