上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页
摘要: P33 Bugs are by far the largest and most successful class of entity, with nearly a million known species. In this respect they outnumber all the other known creatures about four to one. —Professor Snopes' Encyclopedia of Animal LifeP34作者再一次以无比严谨的八卦态度考证了程序员经典都市传奇之:Fortran对identifier的宽松约束导致的NASA轨道 阅读全文
posted @ 2013-08-09 03:18 Joyee 阅读(340) 评论(0) 推荐(0) 编辑
摘要: P4: 好梗!There is one other convention—sometimes we repeat a key point to emphasize it. In addition, we sometimes repeat a key point to emphasize it.P5:UCB的UNIX文档里,tunefs命令的说明有一个叫Bugs的模块,最后一句吐槽道: You can tune a file system, but you can't tune a fish. (tunefs = tune a fish = tuna fish,来自于REO Speedw 阅读全文
posted @ 2013-08-08 07:20 Joyee 阅读(560) 评论(0) 推荐(0) 编辑
摘要: DescriptionDesign a class named Point to represent a point in the plane, and a class named Segment to represent a segment.Using the class interface as followsclass Point{public: Point(double x, double y); void setX(double x); void setY(double y); double getX(); double getY(); private: doub... 阅读全文
posted @ 2013-03-16 20:51 Joyee 阅读(215) 评论(0) 推荐(0) 编辑
摘要: DescriptionRewrite Exercise 7.18 using the string class with the following function header:bool isAnagram(const string &s1, const string &s2)Two words are anagrams if they contain the same letters in any order.自己班的作业写到烦了又跑去蹭别人班的题做……因为这是道改编题,不知道原题的要求是什么,纠结了很久=。=这里的anagram的要求应该是两个字符串具有相同的字符,每种 阅读全文
posted @ 2013-03-16 20:46 Joyee 阅读(258) 评论(0) 推荐(0) 编辑
摘要: Description通过完成类的定义及其实 现:ClassWithCounter,使用下面提供的主函数,可以得到Sample Output中的输出。鉴于大家还没有学习到static成员变量,在你的代码中可以采用全局变量做对象个数的统计。简单地讲,该全局变量初始为0,在 每个构造函数中自增1。在该类中,有一个成员变量记录着自己是第几个。Output在 默认的构造函数中输出如下内容:ClassWithCounter::ClassWithCounter(): id。(注意冒号与id间有一个空格,输出一行)。在析构函数中输出一下内 容:ClassWithCounter::~ClassWithCoun 阅读全文
posted @ 2013-03-13 17:12 Joyee 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Description“ 只要我离开了你的世界,无论你做过什么,我都能忘记你回到从前!”小PY今天很小清新的,大家不要说他腹黑啊。他知道今天大家都学习了析构函数!现在请大 家帮他实现一个类AutoReset,这个类的功能是在一个作用域开始的时候,保存某个变量的值,而当该作用域结束的时候能够实现变量值的Reset。比 如以下这个例子:实现下面这个类:class AutoReset {public: AutoReset(int *scoped_variable, int new_value); ~AutoReset();private: int *scoped_variable_; int ori 阅读全文
posted @ 2013-03-13 17:09 Joyee 阅读(541) 评论(0) 推荐(0) 编辑
摘要: DescriptionDesign a class name Time. The class contains:Data field hour, minute, and second that represent a time.A no-arg constructor that creates a Time object for the current time. (The data fields value will represent the current time.)A constructor that constructs a Time object with a specified 阅读全文
posted @ 2013-03-06 01:25 Joyee 阅读(617) 评论(0) 推荐(0) 编辑
摘要: 7601. calendarDescription小py是一个熊孩子,他 很想知道某一个日期是星期几,于是他找到了你。请你写一个程序,对于输入的某一个日期,输出1-7中某个数值,表示星期一到星期天中某一天(其中1为星期 一)。由于py是个熊孩子,他可能会说出一个不合法的日期,所以你还需要进行日期合法性判断,非法日期输出-1。Input输入包含多组数据。每行包括三个整数y(2000<=y<=9999), m, d。输入数据以0 0 0结束。Output每组数据输出一行,每行包括一个整数。1表示星期一,7表示星期日,等等,若数据非法,则输出-1。0 0 0不需输出7602. calen 阅读全文
posted @ 2013-02-27 15:00 Joyee 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 有首歌的歌词一直很好奇,演唱的瑞典姑娘英文咬字不太清楚,只能听个半懂,但是用Google搜歌词屡搜屡败,只能找到一些人的听写,手头也只有iTunes买来的音源,又不舍得专门买一张CD看BK,最近发现N站的弹幕里有人打了出来,抽出COMMENT之后每行开头都有一部分不需要的时间轴,懒得专门下个软件处理了,干脆自己写试试,运行之后发现效果还不错,好在歌词是英文,处理方便 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 char str[200]; 6 int i, len; 7 FILE *ptr = 阅读全文
posted @ 2013-02-17 04:17 Joyee 阅读(2148) 评论(0) 推荐(0) 编辑
摘要: DescriptionHengheng is a math nerd. Today he invents a new kind of numbers so called H number. These numbers satisfy that each digit is either the sum or the difference of the adjacent digits. Notice that the first and the last digit are not constrained, except that the first digit is not zero (i.e. 阅读全文
posted @ 2013-02-09 14:42 Joyee 阅读(292) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 15 下一页