Continue on the Array of Records program Computer Science 2 Arrays of Records A couple dry runs A Fix it and Continue on the Array of Records program
Dry run the following Use the following for input: 10, 20, 8, 2, 4, -1 program DryRunrecArray; type rectype = record x, y:integer; end; arrayRectype = array[1..10] of rectype; var count, show, total:integer; nums:arrayRectype; temp:rectype; begin count:= 0; total:=0; writeln('Enter value, -1 to quit'); readln(temp.x); while(temp.x <> -1) and (count < 10) do inc(count); writeln('Enter the other value'); readln(temp.y); nums[count] := temp; for show:= 1 to count do writeln(nums[show].x:10,nums[show]. y:10); total:= total + nums[show].x; writeln(total:10); end. Dry run the following Use the following for input: 10, 20, 8, 2, 4, -1
Array of Records Dry Run program arrReRun2_4_11; type rectype = record name:String; num:integer; end; atype = array[1..3] of rectype; var nums:atype; x:integer; y:string; begin y := 'Well '; for x:= 1 to 3 do nums[x].num:= x*10; nums[x].name := y; y:= y + 'Howdy '; writeln(nums[x].name, nums[x].num); end. Array of Records Dry Run
This file is on the class website. program FicksAhRay; //Input 5 names and scores type //Show the above average people rectype = record; name:String; score:integer; atype = array[1..3] of nametype; var person: record; people : array of record; totage, average:real; count:integer; begin for count:= 1 to 5 do writeln('Please enter a name'); readln(name); writeln('Please enter a score'); readln(score); totage := totage + score; average:= total + 1; for count := 1 to 5 do writeln(Above Average People) end; Fix the following This file is on the class website. ArrayRecFix.pas
Program Get 5 Names, schools, Extra Curricular activity Pushes: Show all the information in a chart. (Name, School, Activity) Let the user enter a name and the program will return their school and extra curricular activity. Modify this to be set up as a menu. (Show all, Find person, Find School’s people (Show a list of all students from the school) Pushes: Improve user friendliness of the program. Include an ‘Add another person’ option to the menu. Calculate how many of people there are from each school. Let it support holding an unknown number of records (but less than 100) Write the program using procedures. Add a menu item to sort the information by name.