Question: Using C++ to write program 1. Write a function called deleteRepeats that has a partially filled array of characters as a formal parameter and that
Using C++ to write program
1. Write a function called deleteRepeats that has a partially filled array of characters as a formal parameter and that deletes all repeated letters from the array. Since a partially filled array requires two arguments, the function will actually have two formal parameters: an array parameter and a formal parameter of type int that gives the number of array positions used. When a letter is deleted, the remaining letters are moved forward to fill in the gap. This will create empty positions at the end of the array so that less of the array is used. Since the formal parameter is a partially filled array, a second formal parameter of type int will tell how many array positions are filled. This second formal parameter will be a call-by-reference parameter and will be changed to show how much of the array is used after the repeated letters are deleted. For example, consider the following code: char a[10]; a [0]-'a a [1b' a [2]-'a a [3]-c int size 4 deleteRepeats (a, size) After this code is executed, the value of a[0] is a', the value of a[1 is 'b, the value of a[2 is c' and the value of size is 3. (The value of a[3] is no longer of any concern, since the partially filled array no longer uses this indexed variable.) You may assume that the partially filled array contains only lowercase letters. Embed your function in a suitable test progranm. 14. You have collected reviews from four movie reviewers where the reviewers are anina swapping numbered 0-3. Each reviewer has rated six movies where the movies are numbered 100-105. The ratings range from 1 (terrible) to 5 (excellent). The reviews are shown in the following table 0 Write a program that stores this data using a 2D array. Based on this information your program should allow the user to enter ratings for any three movies. The pro- gram should then find the reviewer whose ratings most closely match the ratings input by the user. It should then predict the user's interest in the other movies by outputting the ratings by the reviewer for the movies that were not rated by the user. Use the Cartesian distance as the metric to determine how close the reviewer's
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
