Question: Creat a C++ program that will read a text file called firstnames.txt containg a list of first names( can range over a hundred names) .
Creat a C++ program that will read a text file called "firstnames.txt" containg a list of first names( can range over a hundred names) . Begin by reading the names from the file and sorting them in alphabetical order. Then, you will compute an alphabetical value for each name where A is 1, B is 2, C is 3 and so on. The alphabetical value of a name is just the sum of the values of the letters in the name. To compute the name-score for a name, you simply multiply this alphabetical value by its position in the sorted list.
Example, once list is sorted in alphabetical order JENNIFER is the 118th name on the list, to compute for the name value it would be 10+5+14+14+9+6+5 = 81.
For the name score for Jennifer it would be 118*81 = 9558
What is the sum total of all the name-scores in the file?
Note: I have a list of first names if needed.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
