Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dry Run Fix it Write a program

Similar presentations


Presentation on theme: "Dry Run Fix it Write a program"— Presentation transcript:

1 Dry Run Fix it Write a program
Computer Science 1 Dry Run Fix it Write a program

2 Learning Objectives Students will be able to read a program that incorporates arrays. Students will be able to write code to declare, input, output and compare values in an array. Students will be able to fix a program that uses arrays. Students will be able to write a program that uses arrays.

3 Dry Run for pos:= 1 to 5 do info[pos]:= pos*2; for pos := 1 to 5 do begin if (pos div 2) > 2 then info[pos]:= info[pos] + pos else info[pos]:= info[pos]*pos; end; writeln(info[pos]);

4 Your turn… Write the type and var section to create arrays to store the following 10 names 15 test scores

5 Try code Write the code to …
Input 10 names into the array created previously Input 15 test scores Output all of the names Output all of the test scores Find and show the highest test score from the array

6 Fix it In the assignments folder there is a program called fixary1.pas
It is supposed to input 10 scores, calculate the average of these score and the show all of the scores that are below average. See if you can fix it!!

7 Program options Enter 10 names and show the names in reverse order.
Input: 10 scores Output: The number of scores within 10 points of the average of the 10 scores. (You’ll need to calculate the average before going back and seeing which scores are within 10 points of the average.) Create a random compliment generator using an array to store the compliments. Using a while loop (so the user can be complimented often) have the computer display one of at least 5 random compliments each time the user would like to be complimented.


Download ppt "Dry Run Fix it Write a program"

Similar presentations


Ads by Google