Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Programming Write a function named mostUnique that accepts an input stream and an output stream as parameters. The input stream represents an input file.
C++ Programming
Write a function named mostUnique that accepts an input stream and an output stream as parameters. The input stream represents an input file. The data in the file represents integer quiz scores separated by spaces. Each class period is on its own line and contains a different number of students. Your function should return the highest number of unique scores given in a single class period. The function should also print information about the number of unique scores given in each period, in a format described below On a given line, all occurrences of any particular number value will occur consecutively in the input. For example, if there is a sequence of occurrences of the number 8, there will not be any other occurrences of the number 8 on that same line outside of that sequence. Given an input stream named input referring to an input file that contains the following text: 10 10 10 9983 3 3 8 10 97 76 6 4 19 9 10 77 10 10 10 10 The call on mostUnique (input, cout) should return 6 and generate the following output: Period 1: 4 unique scores Period 2: 6 unique scores Period 3: 5 unique scores Period 4: 1 unique scores On the first line, there are 4 unique scores: 10, 9, 8 and 3. The second line contains 6 unique scores: 3, 8, 10, 9, 7 and 6. The third line contains 5 unique scores: 4, 1, 9, 10 and 7. The fourth line only has one unique score: 10. The value returned is 6 because it is the highest number of unique scores given in a class period. Assume that the file exists, that it contains at least one line of data and that each line contains at least one scoreStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started