11for_while_loop

11for_while_loop - Introduction to Computers and...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Computers and Programming Lecture 11 Recap visible and directly visible at each place within a program. The visibility rules apply to both explicit and implicit declarations. immediate visibility and use-visibility case selector is when value_list_1 => statement(s)_1; when value_list_2 => statement(s)_2; when others => statement(s)_n; ; Prof. I. K. Lundqvist Reading: FK pp. 199-209, 220-223, 266-267 Sept 29 2003 Scope : determine which declarations are end case
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Iteration For Statement for loop_var in loop statement(s); ; for i in -1 . . 10 loop PUT(i); NEW_LINE; ; for i in 1 . . 10 loop PUT(i); NEW_LINE; ; for i in 2 . . n-1 loop PUT(i); NEW_LINE; ; • Definite iteration – FOR statement • Indefinite iteration – WHILE statement – General LOOP statement low_val . . high_val end loop end loop end loop end loop
Background image of page 2
[assignment_average.adb] [not covered in class] average number of assignments marked by period. marked per month, and display this value. • Specification – A program is required to calculate the a lecturer per month over a 12 month The program will ask the user for the number of assignments marked each month, calculate the average number Courtesy of Chris Lokan. Used with permission.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
[User interface] No. marked in month 1: xxx No. marked in month 2: xxx No. marked in month 12: xxx Average per month is yyy.yy [Algorithm] • ASSIGNMENT AVERAGE PROGRAM • Initialization – Display heading – Set total to zero • Get values over year –For each month • Prompt for and get number marked • Add to total • Calculate average • Display average
Background image of page 4
[Data Design] NAME TYPE
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

11for_while_loop - Introduction to Computers and...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online