带注释的几个csharp小程序.doc声明:这些程序非我本人所写,在此感谢写下这些程序的人,这些都比较程序都比较简单,这些注释都是按照我的****惯写下来的!感觉也挺适合阅读****惯的!仅为学****之用!usingSystem;classUnary{publicstaticvoidMain(){intunary=0;intpreIncrement;intpreDecrement;intpostIncrement;intpostDecrement;intpositive;intnegative;sbytesbyte关键字表示一种整型,该类型根据下表显示的大小和范围存储值。文本可使用下述方法声明并初始化sbyte类型的变量:bitNot;bool我们知道在C++里有专门的bool类型,用来表示真或假。但是在C语言里没有这样的类型(至少我是一直这么认为的),表达式的值0为假,非0为真。所以条件判断语句(if(…)、while(…))非常灵活,甚至一个指针类型都可以是条件表达式。为了使程序更清晰,我们常常会给出如下的宏定义: typedefintBOOL; #RUE1 #defineFALSE0 这是最常见的写法,能被任何C语言编译器认可。今天我在一段程序里看见这么一行#include,这个陌生的头文件还以std打头而且还和bool有关,引起了我的警觉,立刻百度之。得知这是C99标准新增的头文件,意在引入bool类型,使之和C++兼容。随后我看了一下这个头文件的源代码,内容如下logNot;preIncrement=++unary;("Pre-Increment:{0}",preIncrement);preDecrement=--unary;("Pre-Decrement:{0}",preDecrement);postDecrement=unary--;("Post-Decrement:{0}",postDecrement);postIncrement=unary++;("Post-Increment:{0}",postIncrement);("FinalValueofUnary:{0}",unary);positive=-postIncrement;("Positive:{0}",positive);negative=+postIncrement;("Negative:{0}",negative);bitNot=0;bitNot=(sbyte)(~bitNot);("BitwiseNot:{0}",bitNot);logNot=falsefalseOperatorUser-,false,andnull(neithertruenorfalse),asusedindata
带注释的几个csharp小程序 来自淘豆网www.taodocs.com转载请标明出处.