CS 1430 Sections 1, 2, 3 : Parallel Array Review Sheet Parallel arrays are 2 or more arrays such that for a given index the values in the arrays at that index are all related to the same thing/item/person. index 0 1 2 3 4 … 99 idnums 111 222 333 444 555 quizScores 10.0 9.5 8.5 7.5 6.5 firstNames Mike Tim Tom Sue Betsy const int MAX = 100; int main() { int idnums[MAX]; float quizScores[MAX]; string firstNames[MAX]; int howMany; // 3 parallel arrays // placekeeper ReadData(idnums, quizScores, firstNames, howMany); int id; cout << “Enter your id number: “ << endl; cin >> id; int index; // Call Linear_Search function to try to find id, given by the // user; use that index to print out the quiz score. // Write an error message if the id is not found. // TODO – in class on 3/11/2015 /// … return 0; } // assume data in table above, excluding the index column, // is prefaced with number 5 for our input data void ReadData( int ids[], float ary[], string names[], int & howMany) { cin >> howMany; for (int i = 0; i < howMany; i++) cin >> ids[i] >> ary[i] >> names[i]; } // To do : Write the Linear Search Function – in class on 3/11/2015 Exercises for 3/11, 3/13, 2015 Given: const int MAX_STUD = 100; int main() { bool failing[MAX_STUD]; bool passing[MAX_STUD]; int score[MAX_STUD]; int length; // placekeeper similar to howMany // assume that we have called a function to read data into score and length. … } 1. Write a C++ function, named InitAry that takes ary, boolVal and length as parameters. The function should set each component from the first component to the length component (at index: length - 1) of ary to boolVal. 2. Call the function in number 1, twice, once to initialize the first 90 elements of passing to true, and once to initialize first 90 elements of failing to false; 3. Write a C++ function, named SetPassing, that has passing, score and length as parameters. Set the components of passing to true wherever the parallel value of score is greater than or equal to 60, false otherwise. 4. Write a C++ value-returning function named, PassTally that takes passing and length as parameters, and returns the count of elements in passing that are true. 5. Write a C++ value-returning function named, CountScores, that takes grade, length and score as parameters. The function should return the count of values in score that are greater than or equal to grade. 6. Call the functions in problems 4 and 5 and store the results in variables that you declare. 7. Write a C++ value-returning named PassingAverage, that takes score, passing, and length as parameters. The function should return the average of those students that are passing. In other words, the function should only use (sum-up) those scores in the score array whose corresponding element in the passing array is true, and return the average of these. It should return a -1.0 if no one is passing. YOU MUST USE one-and-only one for-loop. 8. Write a C++ value-returning function, named Error, that takes passing, failing, and length as parameters. Error returns true if any parallel elements are the same, false otherwise.