Ray's playground

 
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 56 下一页

2011年3月14日

Project Euler Problem 22

摘要: Usingnames.txt(right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a na 阅读全文

posted @ 2011-03-14 14:10 Ray Z 阅读(258) 评论(0) 推荐(0) 编辑

Printing(Chapter 27 of Cocoa Programming for Mac OS X)

摘要: 1#import"PeopleView.h"2#import"Person.h"34@implementationPeopleView56-(id)initWithPeople:(NSArray*)persons7{8[superinitWithFrame:NSMakeRect(0,0,700,700)];9people=[personscopy];10attributes=[[NSMutableDictionaryalloc]init];11NSFont*font=[NSFontfontWithName:@"Monaco"size: 阅读全文

posted @ 2011-03-14 11:43 Ray Z 阅读(273) 评论(0) 推荐(0) 编辑

Numbers(Chapter 5 of Objective-C Phrasebook)

摘要: 1#import<Foundation/Foundation.h>23intmain(intargc,constchar*argv[])4{56NSAutoreleasePool*pool=[[NSAutoreleasePoolalloc]init];78NSString*test=@"Shanghai;40.00;RayZhang;";9NSScanner*scanner=[NSScannerscannerWithString:test];1011NSString*location;12floatnumber;1314NSCharacterSet*charac 阅读全文

posted @ 2011-03-14 10:39 Ray Z 阅读(201) 评论(0) 推荐(0) 编辑

2011年3月13日

noncopyable implementation in C++

摘要: 1#include<iostream>2usingnamespacestd;34classnoncopyable5{6protected:7noncopyable(){}8~noncopyable(){}9private:10noncopyable(constnoncopyable&);11constnoncopyable&operator=(constnoncopyable&);12};1314classmyclass:privatenoncopyable15{16public:17myclass()18{19cout<<"mycla 阅读全文

posted @ 2011-03-13 16:20 Ray Z 阅读(262) 评论(0) 推荐(0) 编辑

Project Euler Problem 19

摘要: You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Thirty days has September,April, June and November.All the rest have thirty-one,Saving February alone,Which has twenty-eight, rain or shine.And on leap years, twenty-nine.A leap year 阅读全文

posted @ 2011-03-13 12:07 Ray Z 阅读(370) 评论(0) 推荐(0) 编辑

Metaphors for a Richer Understanding of Software Development (Chapter 2 of Code Complete)

摘要: Metaphors are heuristics, not algorithms. As such, they tend to be a little sloppy. Metaphors help you understand the software-development process by relating it to other activities you already know about. Some metaphors are better than others. Treating software construction as similar to building . 阅读全文

posted @ 2011-03-13 11:12 Ray Z 阅读(196) 评论(0) 推荐(0) 编辑

2011年3月11日

Project Euler Problem 21

摘要: Let d(n) be defined as the sum of proper divisors ofn(numbers less thannwhich divide evenly inton).If d(a) =band d(b) =a, whereab, thenaandbare an amicable pair and each ofaandbare called amicable numbers.For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefo 阅读全文

posted @ 2011-03-11 22:40 Ray Z 阅读(194) 评论(0) 推荐(0) 编辑

Welcome to Software Construction(Chapter 1 of Code Complete)

摘要: Developing computer software can be a complicated process, and in the last 25 years, researchers have identified numerous distinct activities that go into software development. They include Problem definition Requirements development Construction planning Software architecture, or high-level design 阅读全文

posted @ 2011-03-11 22:03 Ray Z 阅读(138) 评论(0) 推荐(0) 编辑

Project Euler Problem 15

摘要: Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner.How many routes are there through a 2020 grid?1#include<iostream>2usingnamespacestd;34#definenum415longlongPascalTriangle[num][num];67voidCalcPascalTriangle()8{9PascalTriangle[0][ 阅读全文

posted @ 2011-03-11 17:41 Ray Z 阅读(200) 评论(0) 推荐(0) 编辑

Common Objective-C Patterns(Chapter 4 of Objective-C Phrasebook)

摘要: 1#import"Singleton.h"234@implementationSingleton5staticSingleton*instance;67-(id)init8{9self=[superinit];10if(self){11//Initializationcodehere.12}1314returnself;15}1617+(id)alloc18{19@synchronized([Singletonclass])20{21instance=[superalloc];22returninstance;23}24returnnil;25}2627+(Singleto 阅读全文

posted @ 2011-03-11 16:25 Ray Z 阅读(216) 评论(0) 推荐(1) 编辑

上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 56 下一页

导航