C++
文章平均质量分 53
Kill_King
这个作者很懒,什么都没留下…
展开
-
学习日志—异常处理机制
今天学习了异常处理机制,感觉很强大,但是还是不会用= =,try-throw-catch只知道这三个基本功能,另外配合上多态性,能构成异常检查的体系结构。初步了解C++是我这1个月的首要目的。然后再逐渐深入学习,虽然有些人在鄙视C++,但我依然坚持着自己的想法。我对别人的意思仅做参考。我之前学过VB,和C,虽然基本都是睡过来的。但是一些语法和算法还是有点印象。学C++最吸引我的地方它是一个试图描述世界的语言,当然也是因为这个导致C++很难,对我来说的确很难,可能我是个超集大菜鸟吧。原创 2010-07-24 04:24:00 · 419 阅读 · 0 评论 -
学习日志—const reference
A nonconst reference may be attached only to an object of the same type as the reference itself.A const reference may be bound to an object of a different but related type or to an rvalues.For example:double dval = 3.14;const int &ri = dval;//the com原创 2010-08-02 15:44:00 · 516 阅读 · 0 评论 -
Learning_log—Enumeration
Defining and Initializing Enumerationenum opern_modes {input, output, append};By default, the first enumerator is assigned the value is zero.Each subsequent enumerator is assigned a value one greater than the value of the enumerator that immediately preced原创 2010-08-02 16:12:00 · 507 阅读 · 0 评论 -
Learning_log—const
When a const is initialized by a value that is not a const expression, then it should not be defined in header file.Insted, as with any other variable, the const should be defined and initalized in a source file. And extern declaraion for that const shoul原创 2010-08-02 18:40:00 · 620 阅读 · 0 评论 -
Learning_log—string
Read and dicard any leading whitespace(e.g., spaces, newline, tabs)It then reads characters until the next whitespace character is encountered原创 2010-08-03 05:23:00 · 714 阅读 · 0 评论 -
Learning_log—struct and class
<br />The only difference between a class defined with the class keyword or the struct keyword is the default access level:<br /> <br />By default ,member in a struct are public; those in a class are private.原创 2010-08-02 17:38:00 · 469 阅读 · 0 评论 -
学习日志—lvalue/rvalue
<br />左值(lvalue)就是变量的地址,或者是一个代表“对象在内存中的位置”的表达式。<br /> <br />右值(rvalue)就是变量的值。<br /> <br />变量名出现在赋值运算符左边,就是一个左值;而出现在赋值运算符右边的变量名或字面常量就是一个右值。<br /> <br />vala = valb / 8;原创 2010-08-02 12:46:00 · 447 阅读 · 0 评论 -
Learning_log—vector
<br />Subscripting Does Not Add Elements<br /> <br />Programming new to C++ sometimes think that subscripting a vectors adds elements;it does not:<br /> <br />vector<int> ivec; //empty vector<br /> for (vector<int>::size_type ix = 0; ix != 10; ++原创 2010-08-03 15:58:00 · 562 阅读 · 0 评论 -
Learning_log—pointer
There are only four kinds of values that may be used to initialize or assign to a pointer:A constant expression with value 0An address of an object of an appropriate typeThe address one past the end of another object.Another valid pointer of the same type原创 2010-08-09 16:31:00 · 546 阅读 · 0 评论 -
学习日志—类型和声明—advice
<br />[1]Keep scopes small.<br /> <br />[2]Don't use the same name in both a scope and an enclosing scope.<br /> <br />[3]Declare one name (only) per declaration.<br /> <br />[4]Keep common and local names short, and uncommon and nolocal names longer;<br原创 2010-07-31 19:50:00 · 460 阅读 · 0 评论 -
学习日志—container
<br />A map, a list , and a vector can each be used to represent a things.<br /> <br />However,each has strengths and weaknesses.<br /> <br />For example:<br />subscripting a vector is cheap and easy.<br /> <br />On the other hand, inserting an element bet翻译 2010-07-28 17:11:00 · 452 阅读 · 0 评论 -
学习日志—文件与流
明天开始学习C++的文件与流,当然只是初步了解就好了。深入学习将在下个阶段展开。原创 2010-07-24 04:29:00 · 370 阅读 · 0 评论 -
学习日志—API
WINDOWS程序的控制流程1/程序接入点int APIENTRY WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nCmdShow )2/注册窗口类WNDCLASS wndclass;wndclass.style = CS_HREDRAW | CS_VREDRAW ;wndclsss.lpfnWndProc = WndProc;RegisterClass ( &wndclass );3/建立窗口H原创 2010-07-27 00:46:00 · 408 阅读 · 0 评论 -
学习日志—序
<br /> 看了Bjarne Stroustrup的序章,让我感触颇深的是,C/C++形式的宏是一种严重的缺陷。<br /> <br />另外强制转换的大量使用都是设计不良的标志。<br />原创 2010-07-27 14:39:00 · 368 阅读 · 0 评论 -
学习日志—类型和声明—char
signed char which can hold at least the values -127 to 127unsigned char which can hold at least the values 0 to 255wchar_t enough to hold the largest character set (unicode),wchar_t is a typedef原创 2010-07-29 13:28:00 · 487 阅读 · 0 评论 -
Integer Type
Three forms:int ,signed int ,unsigned intThree sizes:short int(short), int , long int ( long )原创 2010-07-29 13:52:00 · 532 阅读 · 0 评论 -
学习日志—来自他的忠告
<br />[1]Don't reinvent the wheel;use libraries.<br /><br />[2]Don't believe in magic;understand your libraries do,how they do it,and what cost they do it .<br /><br />[3]When you have a choice ,prefer the standard library to other libraries.<br /><br />[4原创 2010-07-29 10:19:00 · 551 阅读 · 0 评论 -
学习日志—类型和声明
<br />虽然知道了一些类型,但是也忽略了一些类型:<br /> <br />C++ Fundamental Type:<br /> <br />a user can difne:<br /> <br />Enumeration type for representing specific sets of values(enum)<br /> <br />A type,void , used to signify the absence of information<br /> <br />Pointer原创 2010-07-29 12:32:00 · 463 阅读 · 0 评论 -
学习日志—给C程序员的建议
为了帮助自己区分之前学习C语言:[1]在C++里几乎不需要用宏。consat或enum定义明显的常量,用inline避免函数调用的额外开销,用template去刻画 families of functions of types, and namespace to avoid name clashes.[2]不要在你需要变量之前去声明它,以保证你能立即对它进行初始化。A declaration can occur anywhere a statement can ,in for-statement ini转载 2010-07-27 17:19:00 · 483 阅读 · 0 评论 -
Learing_log Hints on Selecting Which Container to Use
<br />There are a few rules of thumb that apply to selecting which container to use:<br /> <br />1. If the program requires random access to elements, use a vector or a deque.<br /> <br />2. If the program needs to insert or delete elements in the middle o原创 2010-08-21 14:18:00 · 449 阅读 · 0 评论