11for_while_loop

# 11for_while_loop - Introduction to Computers and...

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

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

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

View Full Document
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
[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.

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

View Full Document
[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
[Data Design] NAME TYPE

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### 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
Ask a homework question - tutors are online