摘要: 教材书名:Problem Solving with C++: The Object of Programming, Fifth Edition (C++面向对象程序设计,第五版)出 版 社:清华大学出版社作 者:(美) Walter Savitch 著 周 靖 译书 号:ISBN 7-302-11818-3/TP.7683在我的另一个博客里:http://hi.baidu.com/wkl05030... 阅读全文
posted @ 2010-01-03 20:00 风之领域 阅读(511) 评论(0) 推荐(0) 编辑
摘要: [代码] 阅读全文
posted @ 2009-11-04 22:24 风之领域 阅读(400) 评论(0) 推荐(0) 编辑
摘要: 1.描述子程序所做的所有事情。(尽量不要编写产生副作用的子程序)2.避免使用无意义的、模糊地或表述不清的动词。例:HandleOutput()改为FormatAndPrintOutput()3.不要仅通过数字来形成不同的子程序名字。4.根据需要确定子程序名字的长度。5.给函数命名是要对返回值有所描述。例:cos(),customerID.next(),printer.IsReady()和pen.C... 阅读全文
posted @ 2009-10-28 16:47 风之领域 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 摘自MSDN:ms-help://MS.MSDNQTR.v90.chs/dv_vccomp/html/4392be92-195c-4eb2-bd4d-49cfac3ca291.htm下面的示例生成与用户定义的运算符有关的 LNK2019。// LNK2019e.cpp// compile with: /EHsc// LNK2019 expected#include <iostream>... 阅读全文
posted @ 2009-10-27 20:25 风之领域 阅读(482) 评论(0) 推荐(0) 编辑
摘要: 在嵌套语句中使用if-else语句一定要注意虚悬问题!//错误的代码void dieOrLive(char& thelife,int lifes){if(lifes<=1||lifes>3)//没有使用花括号,第二个if将与第一个else相匹配!if(thelife=='*')thelife='d';else if(lifes==3)if(thelife==' ') theli... 阅读全文
posted @ 2009-07-10 11:13 风之领域 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 1)将输入当做文本进行处理,并用成员函数get来读取输入时,就使用成员函数eof。2)处理数值数据时,使用>>操作符,例:while(in_stream>>next){sum=sum+next;count++;} 阅读全文
posted @ 2009-06-28 23:31 风之领域 阅读(123) 评论(0) 推荐(0) 编辑
摘要: //>>和get()都可以读取文件尾标记#include <iostream>#include <fstream>using namespace std;int main(){ifstream fin;int index=0;char temp;fin.open("ss.txt");if(fin.fail()){cout<<"Input file o... 阅读全文
posted @ 2009-06-26 19:31 风之领域 阅读(186) 评论(0) 推荐(0) 编辑