CS 135 - Computer Science I - 1. Introduction to Programming. 5. 1.a How to Develop a Program. A program is like a recipe. Pasta for six. â boil 1 quart salty.
René Doursat Department of Computer Science & Engineering University of Nevada, Reno Fall 2005
Computer Science I CS 135 0. Course Presentation 1. Introduction to Programming 2. Functions I: Passing by Value 3. File Input/Output 4. Predefined Functions 5. If and Switch Controls 6. While and For Loops 7. Functions II: Passing by Reference 8. 1-D and 2-D Arrays 8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
2
Computer Science I CS 135 1. Introduction to Programming a. How to Develop a Program b. Writing Pseudocode c. First Elements of C++ d. Looking Under the Hood
8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
3
Computer Science I CS 135 1. Introduction to Programming a. How to Develop a Program 9 A program is like a recipe 9 Steps in program development 9 Procedural programming
b. Writing Pseudocode c. First Elements of C++ d. Looking Under the Hood
8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
4
1.a How to Develop a Program A program is like a recipe
Pasta for six – boil 1 quart salty water – stir in the pasta – cook on medium until “al dente” – serve
8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
5
1.a How to Develop a Program A program is like a recipe
¾ What is programming? 9 programming can be defined as the development of a solution to an identified problem, and the setting up of a related series of instructions that will produce the desired results 9 generally, programming is the construction of an algorithm
8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
6
1.a How to Develop a Program A program is like a recipe
¾ What is an algorithm? 9 informally, a general method for solving a problem, such as a recipe 9 formally, a set of precise steps that describe exactly the tasks to be performed and in which order 9 an algorithm must be precise and unambiguous give the correct solution in all cases eventually end 9 an algorithm frequently involves repetition of an operation
8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
7
1.a How to Develop a Program Steps in program development
¾ Seven basic steps in the development of a program 1. define the problem 2. outline the solution 3. develop the outline into an algorithm 4. test the algorithm for correctness 5. code the algorithm into a specific prog. language 6. run the program on the computer 7. document and maintain the program 8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
8
1.a How to Develop a Program Steps in program development
1. Define the problem 9 to help with initial analysis, the problem should be divided into three separate components:
8/29/2005
the inputs the outputs the processing steps to produce the required outputs from the inputs
CS 135 - Computer Science I - 1. Introduction to Programming
9
1.a How to Develop a Program Steps in program development
1. Define the problem
inputs
8/29/2005
processing steps
CS 135 - Computer Science I - 1. Introduction to Programming
outputs
10
1.a How to Develop a Program Steps in program development
¾ Example: find the average of three numbers 9 what are the inputs and outputs?
number1 number2 ?? number3
8/29/2005
processing steps
CS 135 - Computer Science I - 1. Introduction to Programming
average ??
11
1.a How to Develop a Program Steps in program development
2. Outline the solution 9 decompose the problem in smaller elements and produce a rough draft of the solution:
8/29/2005
the major processing steps involved the major subtasks (if any) the major control structures the major variables and record structures the mainline logic
CS 135 - Computer Science I - 1. Introduction to Programming
12
1.a How to Develop a Program Steps in program development
¾ Example: find the average of three numbers 9 what are the processing steps?
• obtain three numbers number1 number2 number3
• calculate ?? the average
average
• show the result
8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
13
1.a How to Develop a Program Steps in program development
3. Develop the outline into an algorithm 9 the solution outline of Step 2 is expanded into an algorithm • Prompt for three numbers •• obtain Get three numbers three numbers number1 number2 number3
• Add numbers together •• calculate the average Divide the sum by 3
average
•• show result Displaythe a message • Display the result
8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
14
1.a How to Develop a Program Steps in program development
3. Develop the outline into an algorithm 9 here is an equivalent algorithm in a more formal style • Prompt for three numbers • Get x, y, z x y z
• sum = x + y + z • average = sum/3
average
• Display a message • Display average
8/29/2005
CS 135 - Computer Science I - 1. Introduction to Programming
15
1.a How to Develop a Program Steps in program development
4. Test the algorithm for correctness 9 testing is one of the most important step in the development of a program, yet it is often forgotten 9 the main purpose of “desk-checking” the algorithm is to identify major logic errors early, so that they may be easily corrected • sum = x + y + z • average = sum/3 9 try different test values by hand!
8/29/2005
x y z sum avg 1 1 1 3 1 0 0 6 6 2 13 15 17 45 15 ... ... ... ... ...
CS 135 - Computer Science I - 1. Introduction to Programming
16
1.a How to Develop a Program Steps in program development
5. Code the algorithm into a specific programming language 9 only after all design considerations have been met should you actually start to code the program into your chosen programming language: C++ Java FORTRAN 8/29/2005
Basic COBOL
etc. CS 135 - Computer Science I - 1. Introduction to Programming
17
1.a How to Develop a Program Steps in program development
¾ Example: find the average of three numbers 9 core of the program in C++ ...
• Prompt for three numbers > x >> y >> z; x y z
= x + y + z; • sum sum =x+y+z avg = sum/3.0; • average = sum/3
Jan 23, 2006 - Page 1 .... number2 number3 average. ⢠obtain three numbers. ⢠calculate the average ..... alphabetize. ⫠rank = int('a'); yields a value of 97 ...
Aug 30, 2005 - Department of Computer Science & Engineering ... CS 446/646 - Principles of Operating Systems - 1. ..... The distinction is rather between.
Jan 24, 2006 - CS 446/646 - Principles of Operating Systems - 1. ... A computer system consists of hardware, system programs and application programs. 1/24/ ...
Feb 22, 2005 - âforeverâ buttons repeat the same action (the same piece of code) until pressed again. ⢠command center â ask observer, patches or turtles to ...
The material in the book has evolved firstly from our combined experience of working in Computing Services within the University of London at. â¢. King's College ...
Printed on acid-free paper. ISBN-13: ... The people on the Fortran 90 list and comp.lang.fortran. Access ... If you would like to contact us our email addresses are:.
â¢It consists in breaking down (decomposing) a problem into the functional steps that compose it. e.g.: a cooking recipe, the instructions to assemble furniture, etc.
Feb 14, 2005 - Part 1. Read chapters 1, 8 and 9 of the required textbook by Bruce Molay (2002) ... Late assignments will be marked down according to the late.
Sep 9, 2005 - CS 446/646, Principles of Operating Systems, Fall 2005 ... Part 1. Read chapters 1, 8 and 9 of the required textbook by Bruce Molay (2002) ...
Case Study: Introduction to CATIA. 1-5. Design Intent. 1-6. Stages in the Process. 1-7. Understand the CATIA Software. 1-8 .... Lesson 10: Assembly Design.
Sep 29, 2013 - 28. 4.5 Selectors, Properties and Operations ...... of cells called CellSets (with a unique property: each digit must appear exactly once in each.
Case Study: Introduction to CATIA. 1-5. Design Intent. 1-6. Stages in the Process. 1-7. Understand the CATIA Software. 1-8 ..... Lesson 11: Assembly Design.
Downloaded from Digital Engineering Library @ McGraw-Hill ... The reader is hereby forewarned that signal-to-interference ratio cal- culations alone ...... become mired in the âdefinitionmanshipâ (a word coined by Robert Price ..... Both Claude S
No matter how professional your IT organization, if you can't resolve problems quickly and ... Drawing upon his extensive consulting experience, Gary Walker.
If you want to possess a one-stop search and find the proper manuals on your products, you can visit this website that delivers many Tong Ren Tong Ren Zhi. Komikkum Ketto Tong Ren Y N Le Tong Ren Yong Y Er Ci Chuang Zuo Wu. Kappuringu Ansoroj Komikku
If a positive adjective cannot combine with a measure phrase, as in (1c), it also seems ... English. 2 Background. The incompatibility illustrated in (1) and (2) has often been .... If this type of analysis of the measure phrases in (14) were possibl
Relations among musical skills, phonological processing, and early reading ability in preschool children. Journal. Experimental Child Psychology, 83, 111-130.