锘??xml version="1.0" encoding="utf-8" standalone="yes"?>91精品国产综合久久久久久,欧美亚洲国产精品久久,久久伊人亚洲AV无码网站http://www.shnenglu.com/huangjianfu/category/17940.html緗戠粶淇℃伅瀹夊叏zh-cnWed, 26 Oct 2011 07:09:00 GMTWed, 26 Oct 2011 07:09:00 GMT60鍍忓爢縐湪涓鏍峰涔犵數鑴戠紪紼嬶紝scratch鏉ヨ嚜楹葷渷鐞嗗伐http://www.shnenglu.com/huangjianfu/archive/2011/10/24/158980.html榛勫墤鐖?/dc:creator>榛勫墤鐖?/author>Mon, 24 Oct 2011 06:54:00 GMThttp://www.shnenglu.com/huangjianfu/archive/2011/10/24/158980.htmlhttp://www.shnenglu.com/huangjianfu/comments/158980.htmlhttp://www.shnenglu.com/huangjianfu/archive/2011/10/24/158980.html#Feedback1http://www.shnenglu.com/huangjianfu/comments/commentRss/158980.htmlhttp://www.shnenglu.com/huangjianfu/services/trackbacks/158980.html瀹樼綉鍦板潃錛歨ttp://scratch.mit.edu
Scratch鏄竴縐嶈綆楁満緙栫▼璇█錛屽埄鐢ㄥ畠鍙交鏉懼湴鍒涘緩鑷繁鐨勪簰鍔ㄦ晠浜嬶紝鍔ㄧ敾錛屾父鎴忥紝闊充箰鍜岃壓鏈? 鍜屽湪緗戠粶涓婂垎浜綘鐨勪綔鍝併?褰撳鐢熷垱寤哄拰鍏變韓鑷繁鐨凷cratch鍔ㄧ敾鏃訛紝浠栦滑鑳藉涔犲埌閲嶈鐨勬暟瀛﹀拰璁$畻鐭ヨ瘑錛屽悓鏃朵篃寰楀埌鍒涢犳х殑鎬濊冿紝緋葷粺鎺ㄧ悊錛屽拰鍗忓悓宸ヤ綔鐨勬満浼氥?br />
涓轟粈涔堣鐢⊿cratch瀛︿範緙栫▼錛?br />1銆丼cratch涓婃墜闈炲父瀹規槗錛岄備簬8宀佷互涓婂瀛愶紝鎴愪漢涔熷彲浠ョ帺銆傜Н鏈紝鎴戞兂澶у鏁頒漢搴旇鏈夌帺榪囧惂錛屾病瀹為檯鐜╄繃鑷沖皯涔熷惉璇磋繃鍚с傜敤Scratch緙栫▼灝卞儚鐜╃Н鏈ㄤ竴鏍鳳紝闈炲父綆鍗曪紝鎶婂儚涓涓釜縐湪涓鏍風殑鑴氭湰鍛戒護錛屾寜鐓т竴瀹氱殑閫昏緫鍫嗙Н璧鋒潵錛屽氨鍙互鍋氬嚭鑷繁鐨勫姩鐢繪垨娓告垙浜嗐傛湁鍥炬墠鏈夌湡鐩革紝鍚勪綅鐪嬪畼璇峰厛鐪嬪浘銆?br />

2銆丼cratch綆鍗曪紝浣嗚兘鍋氬緢澶氫簨銆備綘鍙互鍒板畼緗戠湅鐪嬩竴浜涗紭縐鐨勪綔鍝侊紝灝辯煡閬揝cratch鑳藉仛浜涗粈涔堝憿銆?br />3銆丼cratch铏界劧涓嶇敤浣犲幓鏁蹭唬鐮侊紝浣嗗畠鍚屽叾瀹冭綆楁満璇█鐨勭紪紼嬫濇兂鏄畬鍏ㄤ竴鏍風殑錛屽拰C錛孋++錛孞ava鐨勭紪紼嬫濇兂娌′粈涔堜袱鏍楓傚鏋滀綘鎳侰銆丆++鎴朖ava錛岄偅浜涘爢縐搗鏉ョ殑鑴氭湰錛屼篃鏄彲浠ョ炕璇戞垚C銆丆++銆丣ava浠g爜鐨勶紝騫朵笖闈炲父綆鍗曪紝緇濆瑕佹瘮鑻辮緲昏瘧綆鍗曞緢澶氬緢澶氥?br />
4銆丼cratch鏄厤璐圭殑錛屽彲浠ュ湪Mac錛學indows鍜孡inux涓婅繍琛岋紝騫朵笖杞歡鐨勮璦鏄彲浠ヨ緗紝涓嶆噦鑻辨枃涔熶笉瑕佹曪紝鍙互鎶婅蔣浠剁晫闈㈣璦璁劇疆涓虹畝浣撲腑鏂囥傚畼緗戠殑绔欑偣涔熸湁涓枃鐨勭増闈€?/div>5銆佺綉绔欑殑鐢ㄦ埛鍙備笌搴﹂潪甯擱珮錛岀敤鎴峰彲浠ヤ笂浼犺嚜宸辯殑浣滃搧鍒拌緗戠珯錛屽彲浠ユ璧忓叾浠栫敤鎴風殑浣滃搧錛岀湅鍒板枩嬈㈢殑涔熷彲浠ヤ笅杞戒笅鏉ョ爺絀剁爺絀訛紝褰撶劧涔熷彲浠ョ敤鍒拌嚜宸辯殑浣滃搧涓摝銆?br />
Scratch鐨勪竴浜涚粺璁℃暟鎹紝浠庡叾涓綘灝卞彲浠ョ湅鍑烘杞歡鏈夊浼樼錛岀湅榪囦箣鍚庢槸鍚﹂夋嫨姝ょ紪紼嬭璦鍋氫負鑷繁鐨勫叆闂ㄨ璦錛岄偅灝辯湅浣犵殑浜嗐?br />絎竴騫呭浘錛歴cratch緗戠珯鐨勮闂呴兘鏉ヨ嚜鍝簺鍩庡競
scratch緗戠珯鐨勮闂呴兘鏉ヨ嚜鍝簺鍩庡競

絎簩騫呭浘錛歴cratch緗戠珯鐨勬敞鍐岀敤鎴峰勾榫勫垎甯冨浘錛堣摑鑹蹭唬琛ㄧ敺鎬э紝綰㈣壊浠h〃濂蟲э級
scratch緗戠珯鐨勬敞鍐岀敤鎴峰勾榫勫垎甯冨浘


]]>
涓轟粈涔堝涔燙http://www.shnenglu.com/huangjianfu/archive/2011/10/20/158764.html榛勫墤鐖?/dc:creator>榛勫墤鐖?/author>Thu, 20 Oct 2011 09:07:00 GMThttp://www.shnenglu.com/huangjianfu/archive/2011/10/20/158764.htmlhttp://www.shnenglu.com/huangjianfu/comments/158764.htmlhttp://www.shnenglu.com/huangjianfu/archive/2011/10/20/158764.html#Feedback1http://www.shnenglu.com/huangjianfu/comments/commentRss/158764.htmlhttp://www.shnenglu.com/huangjianfu/services/trackbacks/158764.html

鍘熸枃鍦板潃錛歨ttp://www.cprogramming.com/whyc.html

涓轟粈涔堝涔燙

Why Learn C?

鐜板湪澶у鍦ㄧ敤鐨勮綆楁満璇█鐨勬暟閲忓寰楀彲鎬曘備粠楂樼駭璇█錛堟瘮濡俈B錛夊埌浣庣駭璇█錛屾湁闈炲父澶氱殑閫夋嫨錛圥erl錛孯uby鍜孭ython璇█錛屽浜庡緢澶氫換鍔$殑瀹炵幇閮芥槸涓嶉敊鐨勯夋嫨錛夈侸ava宸茬粡鎴愪負浜嗕竴浜涢」鐩潪甯稿彈嬈㈣繋鐨勮璦錛屾煇縐嶇▼搴︿笂涔熸槸鍥犱負瀹冩嫢鏈夊ぇ閲忕殑API鍜岃櫄鎷熸満鏈哄埗鎻愪緵浜嗘瘮杈冨ソ鐨勫畨鍏ㄦс傦紙鍐呭瓨鍨冨溇鏀墮泦鍣ㄤ篃鏄竴涓潪甯鎬笉閿欑殑鍔熻兘錛屽彲浠ヤ嬌寰楃▼搴忓憳鏇存湁鏁堢巼銆傦級
There are an awful lot of programming languages available right now -- everything from the extremely high level (such as Visual Basic) to the low level power of assembly, and a good variety of specialized options in between (Perl, Ruby, and Python are good choices for many tasks). Java has also become quite the hot programming language for some tasks, in part because of its large API and in part because the virtual machine provides some elements of security. (Garbage collection is another nice feature and can make programmers much more efficient.)
鐒惰岋紝瀛︿範c璇█緙栫▼錛屼篃鏈夊緢澶氬緢濂界殑鐞嗙敱銆傜涓錛屽巻鍙叉偁涔咃細C璇█宸叉湁30澶氬勾鐨勫巻鍙蹭簡錛堣瘧鑰呮敞錛氬埌鐜板湪宸叉湁榪?0騫翠簡錛夛紝鑳芥壘鍒板ぇ閲忕殑鏈夋晥鐨勬簮浠g爜銆傝繖涔熸剰鍛崇潃鏈夊緢澶氬彲浠ュ涔犵殑渚嬪瓙錛屼篃鏈夊緢澶氭槸鍙互鐩存帴鎷挎潵鐢ㄧ殑浠g爜銆傝屼笖錛岃璦鐨勫緢澶氶棶棰橀兘宸茬粡璇存槑鐨勫緢娓呮--瀹冨彲浠ユ洿濂界殑鐞嗚В錛屽茍涓斾綘鍙互鎵懼埌寰堝寰堜笉閿欑殑鏁欑▼銆傚彟澶栵紝瀵逛簬C錛屼綘鍙互鑾峰緱寰堝浣犺兘鐞嗚В鐨勭湅娉曞拰瑙佽В銆?/div>
Nevertheless, there are some good reasons to learn to program in C. First, age has its advantages: C has been around for 30 years, and there is a ton of source code available. This means there's a lot to learn from, and a lot to use. Moreover, many of the issues with the language have been clearly elucidated -- it's well understood, and you can find a lot of tutorials available. Plus, with C, you get lots of strong opinions mixed with insights that you can understand.

鐢變簬鍘嗗彶鐨勫師鍥狅紝C鍋氫負Unix鐨勪竴涓郴緇熺紪紼嬭璦錛孋宸茬粡鎴愪負浜嗕竴闂ㄩ氱敤鐨勭紪紼嬭璦銆傛湁鏃跺欑敤C璇█鏉ヨ〃杈句竴浜涚紪紼嬩笂鐨勬兂娉曪紝澶ч儴鍒嗕漢閮戒細鎰熻鍒版瘮杈冭垝鏈嶃?br /> As a result of its age and its use as the language of system programming for Unix, C has become something of the lingua franca of programming. C is a great language for expressing common ideas in programming in a way that most people are comfortable with. Moreover, a lot of the principles used in C -- for instance, argc and argv for command line parameters, as well as loop constructs and variable types -- will show up in a lot of other languages you learn so you'll be able to talk to people even if they don't know C in a way that's common to both of you.

絎笁錛孋鏄瘮杈冩帴榪戞満鍣ㄨ璦銆?br /> Third, C is reasonably close to the machine. When you're working with pointers, bytes, and individual bits, things like optimization techniques start to make a lot more sense. There's also utility in knowing exactly how something works underneath the hood -- this helps a great deal when something you're trying to do in a higher level language seems way slower than expected, or just doesn't work at all. You also tend to get a better picture of advanced topics like exactly how networking works. A higher level language will make it a little bit simpler, but it'll be harder to understand what's going on, and when things stop working, it's much better to know exactly what's going on so you can fix it. Additionally, if you like computer science as a discipline, or just like knowing how things work learning the details of the system is great fun.

瀹為檯涓婏紝寰堝鏈夎叮鐨勭紪紼嬮兘鍙互鐢–鏉ュ仛--姣斿錛岀郴緇熻蔣浠跺拰鏁版嵁綆$悊緋葷粺錛圔erkeley DB錛夈傚鏋滀綘鎯沖啓涓涓瘮杈冨鏉傜殑web紼嬪簭錛孋涔熸槸涓涓緢涓嶉敊鐨勯夋嫨銆傚鏋滀綘鎯沖啓涓涓潪甯稿ソ鐨勶紝蹇殑錛孋涔熸槸寰堝ソ鐨勯夋嫨銆備綘鍙互鐢–鏉ュ啓鏁翠釜鎿嶄綔緋葷粺錛屾兂鐢↗ava鏉ュ仛榪欎釜浜嬫儏鏄潪甯擱毦鐨勶紝瀵逛簬鑴氭湰璇█鏉ヨ鏄嚑涔庝笉鍙兘鐨勩傝屼笖C鏄竴闂ㄩ潪甯哥畝媧佺簿鐐肩殑璇█錛屽畠浣垮緱闈炲父鏈夎叮鐨勭紪紼嬬湅璧鋒潵鏇翠紭闆咃紝浣犵殑緙栫▼涔嬫梾灝嗕細鏈変竴涓緢濂界殑寮濮嬨?br /> In fact, a lot of fun programming is done in C -- for instance, system software and data managers such as Berkeley DB. If you want to be able to do more than write a simple web app, C is a great language. If you want to write a great, fast game, C is again a great choice. You can write an entire OS in C. It'll be much harder to do so in Java, and nearly impossible in a scripting language. And the language, being succinct as C is, will probably make your fun program more elegant looking to boot.


鎴戝浜庤繖綃囨枃绔犳墍璋堢殑璇濋錛屾兂琛ュ厖鍑犵偣銆?br />
1銆佸濂紺錛屽彲浠ュ府鍔╃悊瑙e叾浠栬璦涓殑涓浜涙蹇點?br />姣斿Java涓殑寮曠敤鐨勬蹇碉紝濡傛灉鐞嗚В浜咰璇█涓殑鎸囬拡鐨勬蹇碉紝灝辮兘寰堝ソ鐨勭悊瑙?#8220;寮曠敤”榪欎釜姒傚康浜嗭紝鑰屼笉鐞嗚В鎸囬拡鐨勬蹇墊兂鎶婂紩鐢ㄧ殑姒傚康鐞嗚В鐨勫緢閫忓交錛屾槸姣旇緝闅劇殑銆?/div>
2銆佸浼氫簡C璇█錛屽啀瀛︿範鍏朵粬璇█浼氭劅瑙夊埌鏇磋交鏉俱?br />
Object-C錛孞ava錛孋++絳夌瓑寰堝楂樼駭璇█鐨勮娉曢兘涓嶤鏄浉浼肩殑銆傚浼氫簡C鍚庯紝鍩烘湰涓婂彧瑕佽姳涓婁竴鍛ㄧ殑鏃墮棿浜嗚В涓涓嬪叾浠栬璦鐨勭壒鎬э紝灝卞熀鏈笂鍙互鐪嬫噦鍏朵粬璇█鐨勬簮浠g爜浜嗐?/div>
3銆佷粠鐜板疄瑙掑害鏉ヨ冭檻錛屽濂紺錛屾壘鍒頒竴浠藉ソ宸ヤ綔鐨勫彲鑳芥т篃鏄ぇ澶у寮猴紝鐗瑰埆鏄浜庡垰姣曚笟鐨勫ぇ瀛︾敓錛屾垨宸ヤ綔緇忛獙姣旇緝灝戠殑紼嬪簭鍛樸傜幇鍦ㄩ渶瑕佹湁C璇█鍩虹錛屾搮闀夸簬C璇█鐨勶紝宸ヤ綔宀椾綅涔熸槸姣旇緝澶氥傛瘮濡傛嬁鐜板湪闈炲父嫻佽鐨刬Phone錛宨Pad絳夎澶囩殑搴旂敤紼嬪簭錛屽紑鍙戣璦灝辨槸Objective-C璇█銆侽bjective-C鏄嫻鏋淢ac OS X銆乮OS騫沖彴鐨勫紑鍙戣璦錛孫bjective-C鏄熀浜嶤璇█鐨勶紝澧炲姞闈㈠悜瀵硅薄鐨勭浉鍏崇壒鎬с備綘鍙互璁や負Objective-C灝辨槸鍙︿竴涓増鏈殑C++錛屼篃灝辨槸閲囩敤浜嗕笌C++涓嶅悓鐨勮娉曪紝浣嗕篃瀹炵幇浜嗛潰鍚戝璞°備綘鏈変簡C璇█鐨勫熀紜錛屽啀瀛bjective錛岄毦搴﹀氨涓嶅ぇ浜嗐?br />浣犲彲浠ュ埌閭d簺鎷涜仒緗戠珯鍘葷湅鐪嬶紝鏌ユ煡iPhone鐩稿叧鐨勫紑鍙戝伐紼嬪笀鐨勮姹傦紝鏄笉鏄緢澶氶兘瑕佹眰鏈塁/C++鐨勫熀紜鍜岀粡楠屻?br />榪樻湁涓浜涚郴緇熷紑鍙戝拰搴曞眰姣旇緝鐩稿叧鐨勶紝寰堝閮芥槸闇瑕佺敤C璇█寮鍙戠殑銆傛嬁淇℃伅瀹夊叏琛屼笟鏉ヨ錛屽緢澶氬畨鍏ㄤ駭鍝侀兘鏄敤C璇█鏉ュ紑鍙戠殑銆傝繕鏈夋父鎴忚涓氬緢澶氶兘鏄敤C鎴朇++銆?br />
榪樻湁涓鐐癸紝寰堝鍒濆鑰呰涓哄涔燙寰堥毦銆傚叾瀹炴垜鎯寵鐨勬槸闅懼茍涓嶆槸璁$畻鏈鴻璦鐨勯棶棰橈紝闅劇殑鏄洜涓轟綘鐢ㄨ綆楁満瑙i棶棰樼殑鎬濈淮榪樻病寤虹珛璧鋒潵銆傚洜涓轟綘榪涘叆鐨勬槸涓涓柊鐨勯鍩燂紝浠ュ墠娌℃湁鎺ヨЕ榪囪綆楁満緙栫▼錛屽浜庢庝箞鐢ㄨ綆楁満鏉ヨВ鍐崇幇瀹炰腑鐨勯棶棰樼殑榪欑鎬濈淮浣犺繕娌℃湁寤虹珛璧鋒潵錛屾瘯绔熺敤璁$畻鏈鴻В棰樼殑鎬濈淮錛屽拰鐢ㄦ暟瀛﹁В棰樼殑鎬濈淮榪樻槸鏈変簺涓嶄竴鏍風殑錛屾墍浠ヤ綘浼氳寰楀涔燙璇█寰堥毦銆?br />濡傛灉浣犲湪瀛︿範C璇█鐨勫悓鏃訛紝鍐嶈繘琛屼竴浜涚▼搴忓憳鐨勬濈淮璁粌錛屾垜瑙夊緱鎯呭喌灝變細澶ф湁鏀瑰杽銆?/div>

]]>鍒濆鑰呮寚鍗楋細How To Think Like A Programmerhttp://www.shnenglu.com/huangjianfu/archive/2011/10/19/158717.html榛勫墤鐖?/dc:creator>榛勫墤鐖?/author>Wed, 19 Oct 2011 15:03:00 GMThttp://www.shnenglu.com/huangjianfu/archive/2011/10/19/158717.htmlhttp://www.shnenglu.com/huangjianfu/comments/158717.htmlhttp://www.shnenglu.com/huangjianfu/archive/2011/10/19/158717.html#Feedback0http://www.shnenglu.com/huangjianfu/comments/commentRss/158717.htmlhttp://www.shnenglu.com/huangjianfu/services/trackbacks/158717.htmlOver the past decade-and-a-half of teaching introductory computer programming I have noticed increasingly that students have difficulty with solving problems. It is common to see learners read a programming problem description  and immediately try to write the programming language source code (usually whilst sitting at a PC typing straight into the editing window of the compiler environment). When they ask for help it is often the case that their difficulty lies not with manipulating the programming language syntax (C, Pascal, Java, or whatever) but in understanding what it is they're trying to solve. In fact, many times they confuse their syntax-handling difficulties with their problem-solving difficulties and blame their frustration on programming itself or on the chosen programming language. Some of them then become so downhearted that they decide they cannot do computer programming and transfer to a course that doesn't require them to study it.

榪欎釜璇濋鎸烘湁鎰忔濓紝鎴戠湅浜嗕粬鐨勭粌涔犻錛岃繕鐪熶笉閿欙紝鏈夋椂鍊欒寰椼傜畻娉曞拰璁$畻鏈虹殑璇█鐨勫涔犲簲璇ユ槸鏈夊彟澶栦竴縐嶆柟寮忋?br />鎹㈠彞璇濊錛屽湪娣卞叆瀛︿範璇█鍜岀畻娉曪紝鍙互鍏堟潵涓紕熷紑鑳冭彍銆?br />緗戠珯鍦板潃錛?div>http://www.howtothinklikeaprogrammer.com/forum/index.php
涔﹀悕鏄?銆奌ow to Think Like a Programmer: Program Design Solutions for the Bewildered銆婤y Paul Vickers銆?/div>

]]>鍒濆鑰呮寚鍗楋細濡備綍鍍忕▼搴忓憳涓鏍鋒濊?/title><link>http://www.shnenglu.com/huangjianfu/archive/2011/10/19/158670.html</link><dc:creator>榛勫墤鐖?/dc:creator><author>榛勫墤鐖?/author><pubDate>Wed, 19 Oct 2011 03:00:00 GMT</pubDate><guid>http://www.shnenglu.com/huangjianfu/archive/2011/10/19/158670.html</guid><wfw:comment>http://www.shnenglu.com/huangjianfu/comments/158670.html</wfw:comment><comments>http://www.shnenglu.com/huangjianfu/archive/2011/10/19/158670.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/huangjianfu/comments/commentRss/158670.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/huangjianfu/services/trackbacks/158670.html</trackback:ping><description><![CDATA[<div>鍘熸枃錛歨ttp://www.cprogramming.com/tutorial/thinking.html<br /> <div>寰堝浜洪氳繃Email闂垜錛屾庢牱寮濮嬪啓涓涓▼搴忋備篃璁告渶濂界殑寤鴻闈炲父綆鍗曪紝鎶婄▼搴忕殑姝ラ鍐欎笅鏉ワ細涓鏃︿綘寮濮嬫妸鎯蟲硶鎴栬呬唬鐮佸啓涓嬫潵鍚庯紝浣犲氨浼氬浣犵殑欏圭洰鏈変竴浜涙劅瑙変簡銆傞氬父紼嬪簭璁捐鏈変袱縐嶉氱敤鐨勫仛娉曪細浠庝笂鍒頒笅鐨勬柟寮忓拰浠庝笅鍒頒笂鐨勬柟寮忋?br /> A lot of people email me asking the way to start some program or another. Perhaps the best advice is simply to start writing down a layout for the program: once you start writing down ideas or code you'll start to get a feel for your project. There are two standard methods of program design: the top-down approach and the bottom-up approach. Top-down programming involves writing code that calls functions you haven't defined and working through the general algorithm before writing the functions that do the processing. Top-down programming is, to a good degree, a very abstract way of writing code because it starts out by using functions you haven't designed, and that you perhaps do not know how to design. The bottom-up approach to programming is the opposite: the programmer writes the basic functions she realizes will be necessary at some point in the programming and then work up to the more complex parts of the program.<br /> <br /> 姣旇緝鏈夋剰鎬濈殑鏄紝閭d袱縐嶆柟娉曢兘鏄叧娉ㄧ▼搴忎腑瑕佹墽琛岀殑鍔ㄤ綔鎴栨柟娉曪紝鑰屼笉鏄叧娉ㄧ▼搴忚澶勭悊鐨勬暟鎹傚緢澶氭椂鍊欙紝鍐欑▼搴忔渶濂界殑鏂規硶鏄紝鍐欏嚭浣犲皢瑕佺敤鍒版垨澶勭悊鐨勬暟鎹紝鐒跺悗鍐嶄粠涓婂埌涓嬬殑鎯蟲庝箞鏍峰幓澶勭悊榪欎簺鏁版嵁錛屾渶鍚庢墠鑳藉緱鍒頒綘闇瑕佺殑緇撴灉銆傞鍏堝畾涔夋暟鎹紝鐒跺悗鍐嶅啓鍑洪偅浜涜澶勭悊榪欎簺鏁版嵁鐨勭浉鍏崇殑鍑芥暟銆傦紝榪欐牱浣犳墠浼氬緱鍒頒綘鐨勭▼搴忓簲璇ユ庢牱鍐欑殑鍩烘湰鎬濊礬錛?br /> <div>It's interesting that both of these approaches focus on the actions of the program rather than the objects the program manipulates - variables. Many times, the best way to write a program is to figure out the variables you need to work with and then progress with a top-down approach to the program that manipulates those variables. By defining variables first and then working with functions that work on them, you will always maintain a basic foundation of what your program should be doing. Once you have an idea of what variables you will be using, then you can write functions to perform the operations you need to perform on the variables while maintaining sight of the goal. Finally you can write the code for each individual function.<br /> <p>Another value to defining variables before writing code is that many times you can accomplish an entire program without many functions; this fact is especially true when you are a beginner making simple programs. The variables give you the raw materials you need to begin working with the tools: loops, if statements, library functions, and perhaps user defined functions.</p> <p><br /> </p> <p>鐜板湪璁╂垜浠潵鐪嬩竴涓叧浜庢庢牱寮濮嬪啓涓涓畬鏁寸▼搴忕殑渚嬪瓙銆傚亣璁句綘瑕佸啓鐨勭▼搴忔槸瑕佹ā鎷熶竴涓狣VD鍟嗗簵鐨勭鍞郴緇燂紝榪欎釜緋葷粺闇瑕佽綆楀嚭鍑虹DVD鐨勬繪敹鍏ャ備綘鐨勭▼搴忔湁鍙兘瑕佹眰錛岄渶瑕佽緭鍏ヤ竴涓唬鐮侊紝鍛婅瘔浣犺繖涓狣VD縐熷敭鐨勪環鏍兼槸2鍏冧竴澶╄繕鏄槸3鍏冧竴澶╋紝鐒跺悗榪橀渶瑕佸畠鍑虹浜嗗灝戝ぉ錛屾渶鍚庡鏋滆繖涓緭鍏ョ殑浠g爜鏄?錛屾暣涓▼搴忓氨緇撴潫浜嗐備綘搴旇瑕佸垎鍒綆楀嚭縐熼噾涓?鍏?澶╁拰2鍏?澶╃殑DVD鐨勫嚭縐熺殑鎬誨ぉ鏁般傛嬁榪欎釜紼嬪簭鏉ヨ錛屾濊冭璁$▼搴忕殑鏈濂界殑鏂瑰紡鏄紝鎯寵薄涓轟簡璁$畻鍑虹閲戠殑鏀跺叆錛屼綘闇瑕佸瓨鍌ㄥ摢浜涗俊鎭細</p> <p> </p> <div> <ul> <li>浣犻渶瑕佷竴涓彉閲忕敤鏉ュ瓨鍌ㄦ繪敹鍏ワ紝褰撶▼搴忕粨鏉熸椂;<br /> </li> <li>浣犻渶瑕佷竴涓復鏃跺彉閲忕敤鏉ュ瓨鍌ㄤ唬琛―VD鐨勭閲戠殑浠e彿;<br /> </li> <li>浣犻渶瑕佷竴涓復鏃跺彉閲忕敤鏉ュ瓨鍌ㄦ煇涓狣VD鍑虹鐨勫ぉ鏁? </li> <li>浣犻渶瑕佷竴涓彉閲忔潵瀛樺偍縐熼噾涓?鍏?澶╃殑鎵鏈塂VD鍑虹浜嗗灝戝ぉ鐨勬繪暟;<br /> </li> <li>鏈鍚庯紝浣犺繕闇瑕佷竴涓彉閲忔潵瀛樺偍縐熼噾涓?鍏?澶╃殑鎵鏈塂VD鍑虹浜嗗灝戝ぉ鐨勬繪暟;</li> </ul> </div> <p> </p> <p>Let's take a look at an example of how to go about thinking about a program. If you were to write a program to simulate a video store rental system that calculates the gross revenue from rentals, you might be asked to write a program that accepts a code telling you whether a certain video was rented at $2.00 (input as 2) a day or $3.00 (input as 3) a day and then asks for how many days it was rented out for; finally, if the code for the cost of rental is 0 the program should terminate. You should also count the number of days videos were rented at $3.00 per day and $2.00 per day. The best way to think about the design for a program such as this one is to imagine what information you need to store in order to calculate the revenue:<br /> </p> <ul> <li>you need a variable to store the total dollar amount at the end of the program;<br /> </li> <li>you need a temporary variable to store the code for the cost of a transaction;<br /> </li> <li>you need a temporary variable to store the number of days a specific video was rented;<br /> </li> <li>you need a variable to store the number of days each video was rented;<br /> </li> <li>you need a variable to count the total number of days $3.00 videos were rented;<br /> </li> <li>finally, you need a variable to count the total number of days $2.00 videos were rented.</li> </ul> <p>涓鏃︿綘璁よ瘑鍒頒綘闇瑕佽繖浜涙暟鎹紝閭d箞浣犲氨寰堝鏄撴兂鍑哄浣曞鐞嗚繖浜涙暟鎹?姣斿錛屼綘鐭ラ亾縐熼噾2鍏?澶╃殑DVD鐨勬繪敹鍏?鎵鏈夌閲戜負2鍏?澶〥VD鐨勫嚭縐熷ぉ鏁頒箣鍜?2錛涚被浼肩殑涔熷彲浠ヨ綆楀嚭縐熼噾3鍏?澶╃殑DVD鐨勬繪敹鍏ャ備綘涔熶細鐞嗚В榪欎釜“浠h〃DVD鐨勭閲戠殑浠e彿”錛岃繖涓彉閲忕殑鐢ㄥ鏄紝褰撶敤鎴瘋緭鍏ユ煇涓狣VD鍑虹鐨勫ぉ鏁版椂錛屽喅瀹氬摢涓彉閲忎細琚搷浣溿傚湪浣犵殑紼嬪簭涓綘闇瑕佷竴涓驚鐜粨鏋勩?/p> <p><br /> </p> <p>Once you realize you need these variables, you can easily imagine how to translate them in terms of each other: for example, you know the total amount of revenue is the number of days videos at $2.00 were rented times $2.00; in similar fashion, you know the relationship for $3.00 a day videos. You should understand that the transaction 'code' determines which variables are manipulated when the user inputs the number of days a specific video was rented (for example, whether to add to the count of days for $2.00 videos or $3.00 videos). You'll probably need a loop in your program (although you can't necessarily infer this from the variables).</p> <p> </p> <p>紼嬪簭鐨勪唬鐮佹湁鍙兘浼氬儚涓嬮潰閭f牱錛?br /> </p> <div> <p>The code might look as follows:</p> <div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> --><span style="color: #008080; "> 1</span> <span style="color: #000000; "></span><span style="color: #008080; "></span> <span style="color: #000000; "><br /> </span><span style="color: #008080; "> 3</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> main()<br /> </span><span style="color: #008080; "> 4</span> <span style="color: #000000; ">{<br /> </span><span style="color: #008080; "> 5</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> total_dollars </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /> </span><span style="color: #008080; "> 6</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> total_days_at_3_dollars </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /> </span><span style="color: #008080; "> 7</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> total_days_at_2_dollars </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /> </span><span style="color: #008080; "> 8</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> transaction_code </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /> </span><span style="color: #008080; "> 9</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> days_for_one_video </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /> </span><span style="color: #008080; ">10</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">do</span><span style="color: #000000; "><br /> </span><span style="color: #008080; ">11</span> <span style="color: #000000; ">  {<br /> </span><span style="color: #008080; ">12</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(transaction_code</span><span style="color: #000000; ">==</span><span style="color: #000000; ">2</span><span style="color: #000000; ">)<br /> </span><span style="color: #008080; ">13</span> <span style="color: #000000; ">      total_days_at_2_dollars</span><span style="color: #000000; ">+=</span><span style="color: #000000; ">days_for_one_video;<br /> </span><span style="color: #008080; ">14</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; ">(transaction_code</span><span style="color: #000000; ">==</span><span style="color: #000000; ">3</span><span style="color: #000000; ">)<br /> </span><span style="color: #008080; ">15</span> <span style="color: #000000; ">      total_days_at_3_dollars</span><span style="color: #000000; ">+=</span><span style="color: #000000; ">days_for_one_video;<br /> </span><span style="color: #008080; ">16</span> <span style="color: #000000; ">    cout</span><span style="color: #000000; "><<</span><span style="color: #000000; ">"</span><span style="color: #000000; ">Please enter a transaction code and number of days a video was rented: </span><span style="color: #000000; ">"</span><span style="color: #000000; ">;<br /> </span><span style="color: #008080; ">17</span> <span style="color: #000000; ">    cin</span><span style="color: #000000; ">>></span><span style="color: #000000; ">transaction_code</span><span style="color: #000000; ">>></span><span style="color: #000000; ">days_for_one_video;<br /> </span><span style="color: #008080; ">18</span> <span style="color: #000000; ">  }</span><span style="color: #0000FF; ">while</span><span style="color: #000000; ">(transaction_code</span><span style="color: #000000; ">!=</span><span style="color: #000000; ">0</span><span style="color: #000000; ">)<br /> </span><span style="color: #008080; ">19</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">錛?br /> </span><span style="color: #008080; ">20</span> <span style="color: #000000; ">} <br /> </span></div> <p>鎴戝笇鏈涳紝浣犵幇鍦ㄥ凡緇忔湁浜嗕竴涓熀鏈殑鎬濊礬錛屽湪鍐欎唬鐮佷箣鍓嶏紝搴旇濡備綍瀹夋帓浣犵殑紼嬪簭鐨勭粨鏋勩?br /> </p> <p>Hopefully, you now have a basic idea of how to lay out your program structure in your mind before you begin to write code.</p> </div> <p> </p> </div> </div> </div><img src ="http://www.shnenglu.com/huangjianfu/aggbug/158670.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/huangjianfu/" target="_blank">榛勫墤鐖?/a> 2011-10-19 11:00 <a href="http://www.shnenglu.com/huangjianfu/archive/2011/10/19/158670.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.djmb.net.cn" target="_blank">精品综合久久久久久888蜜芽</a>| <a href="http://www.x2799.cn" target="_blank">久久国产成人午夜aⅴ影院</a>| <a href="http://www.945ba.cn" target="_blank">亚洲国产精品无码久久98</a>| <a href="http://www.kovnxs.cn" target="_blank">精品综合久久久久久888蜜芽</a>| <a href="http://www.wlka6.cn" target="_blank">国产精品gz久久久</a>| <a href="http://www.yslianzheng.cn" target="_blank">久久精品国产男包</a>| <a href="http://www.sixyin.cn" target="_blank">久久青青草原综合伊人</a>| <a href="http://www.gyvgllqc.cn" target="_blank">亚洲欧洲精品成人久久奇米网</a>| <a href="http://www.30ww.cn" target="_blank">九九精品99久久久香蕉</a>| <a href="http://www.nmgr.net.cn" target="_blank">久久久WWW成人免费精品</a>| <a href="http://www.enjoa.cn" target="_blank">久久久久久毛片免费播放</a>| <a href="http://www.88177.com.cn" target="_blank">久久精品国产一区二区三区</a>| <a href="http://www.ramar.com.cn" target="_blank">亚洲色婷婷综合久久</a>| <a href="http://www.gmve.cn" target="_blank">久久久久久久国产免费看</a>| <a href="http://www.gzmxjc.cn" target="_blank">97久久精品国产精品青草</a>| <a href="http://www.25552l.cn" target="_blank">久久午夜无码鲁丝片秋霞</a>| <a href="http://www.ru87.cn" target="_blank">国产精品无码久久四虎</a>| <a href="http://www.scstnysc.cn" target="_blank">国产成人久久精品激情</a>| <a href="http://www.duange.com.cn" target="_blank">色狠狠久久综合网</a>| <a href="http://www.zhchengzhi.cn" target="_blank">久久久91人妻无码精品蜜桃HD</a>| <a href="http://www.ssc980.cn" target="_blank">国产美女久久精品香蕉69</a>| <a href="http://www.ampul.cn" target="_blank">伊人久久大香线蕉综合影院首页 </a>| <a href="http://www.ssc905.cn" target="_blank">久久夜色精品国产</a>| <a href="http://www.jkzyzj.cn" target="_blank">久久综合欧美成人</a>| <a href="http://www.douyinyutang.cn" target="_blank">人妻精品久久久久中文字幕一冢本</a>| <a href="http://www.gdgzwz.cn" target="_blank">久久精品国产黑森林</a>| <a href="http://www.999966.com.cn" target="_blank">丰满少妇人妻久久久久久4</a>| <a href="http://www.kzhg.net.cn" target="_blank">国产精品99久久免费观看</a>| <a href="http://www.shiweey.cn" target="_blank">7777精品久久久大香线蕉</a>| <a href="http://www.hpexpfe.cn" target="_blank">久久亚洲国产精品成人AV秋霞</a>| <a href="http://www.gawagapu.cn" target="_blank">久久久久久毛片免费看</a>| <a href="http://www.girla.cn" target="_blank">久久最新精品国产</a>| <a href="http://www.hhjzw.cn" target="_blank">A级毛片无码久久精品免费</a>| <a href="http://www.djz1000.cn" target="_blank">久久99毛片免费观看不卡</a>| <a href="http://www.kdzj.net.cn" target="_blank">99久久婷婷免费国产综合精品</a>| <a href="http://www.3171unp.cn" target="_blank">国产麻豆精品久久一二三</a>| <a href="http://www.9a0g.cn" target="_blank">久久96国产精品久久久</a>| <a href="http://www.seo30.cn" target="_blank">好久久免费视频高清</a>| <a href="http://www.liushishipin.cn" target="_blank">77777亚洲午夜久久多喷</a>| <a href="http://www.fsyongli188.cn" target="_blank">狠狠色丁香久久婷婷综</a>| <a href="http://www.mengyun868.cn" target="_blank">久久精品国产福利国产秒</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>