< previous page page_642 next page >

Page 642
1. Write a C++ function that initializes all components of failing to FALSE. Pass failing and length as parameters.
2. Write a C++ function that has failing, score, and length as parameters. Set the components of failing to TRUE wherever the parallel value of score is less than 60.
3. Write a C++ function 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.
4. Write a C++ value-returning function PassTally that takes passing and length as parameters, and returns the count of components in passing that are TRUE.
5. Write a C++ value-returning function Error that takes passing, failing, and length as parameters. Error returns TRUE if any parallel components are the same.
6. Write a C++ function that takes score, passing, grade, and length as parameters. The function should set the components of passing to TRUE wherever the parallel value of score is greater than grade.
7. Write a C++ value-returning function 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.
8. Write a C++ function that takes score and length as parameters, and reverses the order of the components in score; that is, score[0] goes into score[length-1], score[1] goes into score[length-2], and so on.
Programming Problems
1. The local baseball team is computerizing its records. You are to write a program that computes batting averages. There are 20 players on the team, identified by the numbers 1 through 20. Their batting records are coded in a file as follows. Each line contains four numbers: the player's identification number and the number of hits, walks, and outs he or she made in a particular game. Here is a sample:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
3  2  1  1
The example above indicates that during a game, player number 3 was at bat four times and made 2 hits, 1 walk, and 1 out. For each player there are several records in the file. Each player's batting average is computed by adding the player's total number of hits and dividing by the total number of times at bat. A walk does not count as either a hit or a time at bat when the batting average is being calculated. Your program prints a table showing each player's identification number, batting average, and number of walks. (Be careful: The players' identification numbers are 1 through 20, but C++ array indices start at 0.)
2. An advertising company wants to send a letter to all its clients announcing a new fee schedule. The clients' names are on several different lists in the company. The various lists are merged to form one file, clientNames, but obviously, the company does not want to send a letter twice to anyone.
Write a program that removes any names appearing on the list more than once. On each line of data, there is a four-digit code number, followed by a blank and then the client's name. For example, Amalgamated Steel is listed as
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
0231 Amalgamated Steel

 
< previous page page_642 next page >