Come on, mike, what happened to testing? What answer does this code give for 15 + 6 ? It looks to me that it will return 75. Is that correct?
Originally posted by mike cool:
ok guys i solve to sum to int arrays without using BigInteger
here is the code
pls tell me if there is any thing wrong
And from Brian Kernighan & Dennis Ritchie, 1988, The C Programming Language, 2nd ed, Prentice Hall, p 59:
Falling through to the next case can be useful in some circumstances. But in most cases a break should come after the code that a case label selects. Good coding style suggests that you always use some form of FALLTHROUGH comment to document an intentional fall-through.
... You should terminate the last group of statements in a switch with a break, return or throw, as you would a group of statements in an earlier case. Doing so reduces the likelihood of accidentally falling through the bottom of what used to be the last part of the switch when a new case is added.
It's a while since that book last came down off the shelf! For any youngsters who have read this far, and don't know why Dennis Ritchie's opinions about the C switch statement should be of interest, he designed and first implemented C, after which he and Ken Thompson (no relation) used it to create an operating system that came to be called unix.
Falling through cases is a mixed blessing. On the positive side, it allows several cases to be attached to a single action ... But it also implies that normally each case must end with a break to prevent falling through to the next. Falling through from one case to another is not robust, being prone to disintegration when the program is modified. With the exception of multiple labels for a single computation, fall-throughs should be used sparingly, and commented.
As a matter of good form, put a break after the last case ... even though its logically unnecessary. Some day when another case gets added at the end, this bit of defensive programming will save you.
The algorithm is a general search strategy which can be applied to different games. But the state values depend on the game, and are independent of the algorithm. You need to study the game, rather than the search algorithm. Your end result has two parts: search algorithm + state valuation algorithm.
Originally posted by Sarah isme:
how do you know which value to give to things and stuff like this, nowhere seems to explain this!