04 2008 档案

     摘要:   突然想到C++里有个变量引用的用法,使想到了一个自己觉得有点怪的东西。
  既然引用是一个变量的别名,与原变量都是指向同一个内存空间,那函数返回了变量的引用会不会能像变量一样可以赋值?便写了下面一段:
#include
using namespace std;

char& str(char* a, int i)
{
return a[i];
}

int main(void)
{
char a[] = "A donkey";
str(a, 2) = 'm';
cout << a << endl;
return 0;
}  阅读全文

posted @ 2008-04-13 07:49 Codeboy| 编辑 |

     摘要: Is Friday the 13th really an unusual event?
That is, does the 13th of the month land on a Friday less often than on any other day of the week? To answer this question, write a program that will compute the frequency that the 13th of each month lands on Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday over a given period of N years. The time period to test will be from January 1, 1900 to December 31, 1900+N-1 for a given number of years, N. N is non-negative and will not ex  阅读全文

posted @ 2008-04-09 17:38 Codeboy| 编辑 |

     摘要: 1.把C++当成一门新的语言学习(和C没啥关系!真的。);

2.看《Thinking In C++》,不要看《C++变成死相》;

3.看《The C++ Programming Language》和《Inside The C++ Object Model》,不要因为他们很难而我们自己是初学者所以就不看;

4.不要被VC、BCB、BC、MC、TC等词汇所迷惑——他们都是集成开发环境,而我们要学的是一门语言;

5.不要放过任何一个看上去很简单的小编程问题——他们往往并不那么简单,或者可以引伸出很多知识点;
  阅读全文

posted @ 2008-04-08 19:51 Codeboy| 编辑 |

     摘要: 写于观看完《The Matrix Revolutions》首影(长沙)后三小时,2003年11月10日凌晨一点,作者倪 硕持有文章所有权,但欢迎任何形式的转贴,但请注明文章原作者,以及文章出处http://nishuo.35123.net并且欢迎访问MatrixCpp的专栏
-
为了使得剧情更好被大多数程序员理解,我使用了下面的假象等式,阅读时请注意~:)
Windows ==Matrix Linux==Human Being
-
背景:这个世界本来只有Linux这一种系统,后来种种原因(可以拍Matrix前传,呵呵)Windows这个系统统治了这个世界,而Linux只剩下了微内核存在(Zio),并且Windows系统一直企图完全消灭Linux。
  阅读全文

posted @ 2008-04-08 19:48 Codeboy| 编辑 |

     摘要:   我觉得C++最大的优势在于她的通用和全面。我们往往听到C++和其他语言的比较:诸如运行效率不如C啦、应用软件的开发效率上不如Java和.NET啦、GUI开发不如VB啦……以及在各个方面与各种专用语言和脚本语言的比较。似乎C++就没有自己最突出的地方,简直一无是处。我想说的是,先不谈比较的结果,这些比较能够成立,本身就说明了C++的优势——她是通用的,她是全面的。在成熟的主流语言中,除了C++,还有谁能够做到这一点?!   阅读全文

posted @ 2008-04-08 19:36 Codeboy| 编辑 |

     摘要: A group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends might or might not give some money to any or all of the other friends. Likewise, each friend might or might not receive money from any or all of the other friends. Your goal in this problem is to deduce how much more money each person gives than they receive.   阅读全文

posted @ 2008-04-08 19:12 Codeboy| 编辑 |

     摘要: It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do, however, let the groups know ahead of time which will be picked up for each comet by a clever scheme: they pick a name for the comet which, along with the name of the group, can be used to determine if it is a particular group's turn to go (who do you think names the comets?  阅读全文

posted @ 2008-04-08 18:44 Codeboy| 编辑 |

     摘要: 深入某个东西是一门很讲究的艺术;它会像难住一个新手一样难住一个资深的程序员,并且它还不易言表。这可能包含许多考虑和回退,也包含着预见,直觉,创造力,甚至运气。当这些因素不能够很好的协调时,任何一个程序员都会感到无助。有的时候就是这种无助的感觉使得很多程序员泄气而放弃尝试Div1中的难题。有的程序员甚至放弃了比赛,因为他们很不喜欢那些问题给他们带来的不快感觉。尽管如此,如果一个人能够持之以恒,解决方法通常并不是超出人们所能理解的范围。这篇教程将试图澄清一些事实,来让你能够使用一个稳定的计划去做这些问题。  阅读全文

posted @ 2008-04-08 12:26 Codeboy| 编辑 |