Final Exam review: (closed books and no notes)
5 programming questions
1- Pointers (know how to create an array dynamically and how to delete it)
4- Functions (testing you on pass by value, pass by reference, pass by pointer, pass a one dimensional array, pass a two dimensional array)
Write a program to read a string from the keyboard and store it in a C string. Display the number of lowercase characters, the number of uppercase characters and the number of numerals.
Write a program to read a string. Display the most frequent character in that string. Each time that character appears in the string replace it with the character + and replace the next most frequent character with -. Display the new string.
Write a program to simulate the game of craps as follows. A player rolls two dice. Each die has six faces. These faces contain 1, 2, 3, 4, 5 and 6 spots. After the dice have come to rest, the sum of the spots on the two upward faces are calculated. If the sum is 7, or 11 on the first throw, the player wins. If the sum is 2, 3 or 12 on the first throw (called “craps”), the player loses. If the sum is 4, 5, 6, 8, 9 or 10 on the first throw, then that sum becomes the player’s “point.” To win you must continue rolling the dice until you “make your point.” The player loses by rolling a 7 before making the point.
Define a structure called employee. The employee structure has a field for name and a field for age. Write a program to define an array of 4 employees. Write a function to read values for this array. The function should accept the array as a parameter. Another function should accept this array as the parameter and return the name and age of the oldest employee. Display these values in the main.