CS100 Summer 2021 Exam 1
You have to fill ten blanks in the following program such that it performs the following two
tasks correctly, for ANY values in the students list. First, it should find positions of a name
entered by the user that the name would occupy if all student names were to be ordered.
Secondly, it should find and print all names with the longest length.
If you have a confusion, work out the answer given ‘Ali’ as input and compare with the output
below. Since ‘Ali’ occurs twice in the list, it occupies two positions (from position 2 to position
3) if all students were put in order. Note that the first position is position 0.
Enter a name: Ali
‘Ali’ would be at positions 2-3
Longest names are: Hamid Ahmad Sarah Ahmad
Recall that you can use ‘push_back’ to add something to a vector. Also note that the ‘clear’
function is used to remove everything from a vector.
You can solve it with one statement per blank, but you are allowed to add more than one
statements per blank if your solution requires more lines.