梦想成真(C++版)

学以致用 while (efforts) {gains++;}

  C++博客 :: 首页 :: 联系 :: 聚合  :: 管理
  5 Posts :: 6 Stories :: 0 Comments :: 0 Trackbacks

常用链接

留言簿(1)

我参与的团队

搜索

  •  

最新评论

阅读排行榜

评论排行榜

平时学习过程中遇到的一些小问题,简单回顾一下: 1 C/C++预处理器区分大小写吗? 答:C系语言都区别,如C,C++,C#,Java等;VB.Net不区分大小写 2 运行时最好将前面的运行黑色窗体关掉;不然可能会有异常 3 两个Double类型数据相减比较, double 一般不直接==比较 4 Int a ; Sqrt(a);中 a不能为int类型; 可以用sqrt(double (a)) 5 Do clean you folder before zipping a project. You should remove "Debug" folder , *.ncb and *.suo file. So the size will become much smaller 6? #include When I run in win32 console it should be Without “.h”just like #include I don’t know why some books have this phrase with .h , What differences are there between the two? 7 Using namespace std; This is essencial ,But we must know that in the CLR of VC++ projcet there is a sentence named “using namespace system”, They are different 8 #include If it is neglected : The included headfiles such as #include will be skipped when look for precompiled header 9 Write 2==i instead of i==2put the virable behand of the number int * p; write null==p instead of p==null It doesn't look strange, indead, in company we have to do like that 10 The function of srand (垂头剪子布) If there is no srand but only rand ,then it will output the same data for N times “如果不用srand(),而直接用rand(),每次运行产生的随机数都是一样的。这个你写一段代码就可以知道。 srand()起设置随机种子的作用. 用srand((unsigned)time(NULL))可以产生伪随机数列,一般情况都可以满足要求. 详细情况你查MSDN就知道了,上面也有范例,本来想拷过来,算了,你自己看吧,自己动手要好些。” Sometimes it will remind me that it will lead loss of data when execute srand(time (NULL)), but sometimes once I close the C command window there is no errors in fact ,I don’t know why 11 The use of “_itoa” function “_Itoa:”can Converts an integer to a string.but for safe you’d better use “_itoa_s” 12 The style of code as a engineer the code should be tide up. E.g. int main() {int aCnt = 0... It must be as this: int main() { int aCnt = 0... You can select all text in the .cpp file and call Edit/Advanced/Format Selection. it will tide up the code. 13 It's not a good way to declare virables in one line. E.g. int aCnt = 0,eCnt = 0,iCnt = 0,oCnt = 0,uCnt = 0, also case 'a':case'A': ++aCnt;break; should be case 'a': case 'A': ++aCnt; break;
posted on 2009-05-19 17:17 Betty 阅读(189) 评论(0)  编辑 收藏 引用 所属分类: C++

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理