You are on page 1of 110
and Problem Solving Teint wt acute poe 1+ Torii tan pti {+ baruratanoreetpeanmeg arose s esate cept ardenosten proces, ban behisoyd Ne Cr+ npn Te barubatthondeconpnsrsa «cmp ee andhow oy wet gether 1+ Tobira som olbe kaszameal ste carton camping tetra, Toteablets + Usa stgesion rg ¢empobfegam + Descie whate corps he dos, siagushtetweenhanure ard sate + hse an apie rte met beeping an alten ate, Overview of Programming Men 2 CHAPTER Orervew of Pregramming and Polen Saving 1.1 Overview of Programming ccomeputver \kom-pyi8 ae. offen arte (1646): one that computes; specif: pregram= rable electronic device that can store, reteieve, and process data." {What a brief definition for something thar has, in just few decedes, changed the way offen industrialized societieet Computers touch all areas of ous lives paying bills, des ingcars wring the telephone, shopping In foot, & would he ease to let have areas OFM les that are not affected by computers Ie is sad that «device thar des a0 muck good i 90 oken maligned and fared, Howe ‘any times have you heard someone say, “'m sorry our computer fouled things wp” or “L jase don's anderstand computers; theyre too complicated for me? The very fact that you far: reading this book, however, meas thar you ars ready co st eside prejudice ad leara bout eon puters. Bac be forewaened: This book isnot jastbour computers in heabstiae This va cent co each you how to prograta compels. What Is Prograrmming? Much of buman behavior and thoughts charactcried by logical sequences. Since infancy, yourhave boca lesiming how to act howto do things, You have also Tetened toexpect certain kchavice from other people. Alor of whac you do every day, you do automatically, Fostunately it s nor news for you co consciously think of every sep involved ix a process simple as wating a pase by hand! 1 Lift hand 2 Move hand to right sido of beck, & Grasp roprighs corner of pa. 4. Move hend from right to lle until page is positioned so that you cen read whe on thother side ‘8 Let go of page “Think how many noarons must fe an how many’ mascles mos eespond all in Pogsoisng Porrgeeatons J © certain ander ce sequence, to move yourarm and hand Yet youda i uncon roreoravaacaucaran | scoudy at Mich of what you do unconsciously you once ad to learn. Wateh howe ler Apmgennate tice | baby concentrates on putting ore foot before the other while learning to walk Petra erie anagrams | Then watch a group of hece-year olds playing tag, a (On broader sake, mathematics never could have boon developed without Camsseeare Avast | Ipgical sequences of top tor solving problemsand provingtheoret, Mars (sucies tase setawaltse | Uection never woald have worked without operations taking place in a serain ‘onder, Or whale civilization i based om the order of things ar aston ‘We create uses, bots consciously aed uncbasciously, ahrougi a process we call ogra. This book is concerned with the programming of one of our ros, the care Jus asa concen progran lis the order in which the players pesfoem pies, ‘soa cone avr Tiss te seqienec of steps the computer performs. From now aR, when we use the wards progranesuag and program, we mean carostr prerrnny and computer program. 1.1 Over of Programing ‘The computer allows ws to do tasks more efficients, quickly, and accurately than we could By hand—if we could do them hy hand at all. To use sis powerful tna, we must Specify whae we wane done and the order in which we want it dane, We do this theough Progesmnming. How Do We Write a Program? ‘A computer is not intelligent. It eannot analyze 2 problem and come up with a solution Instead, a human (the programmer) muse analyze the problem, develop a sequence of in structicos for solving the problem, and then communicate i to the computer, What's the advantage ofusinga computer ifiecane solve problems? Once we have written thesolution 84 sequence of insizuctions forthe computer, the computer can repeat te solution very {quickly and consistently, again and again, The computer frees people From repetitive and Dronng ras. “To wite a sequence of instructions fora eompucer ro follow, we most go thzough a worphase process: problem solving al smplenrentaion (see URE 11). Phase * Arabs and specication Undersond (dtne) che problem and what the solton must 2 Geveral solution algorithm). Develop logical sequence of steps chat solves te prob lem. 3. Verify: Follow the steps exactly to se ifthe solution really does solve the problem. Problem-Solvt | in | ly = Copy nantes

You might also like