You started working for a talent agency. Your supervisor gave you a job to rename 50 files saved in a photographer's folder and the filenames start with dsc001.jpg thru dsc050.jpg. The photographer used a list on a printout of the firstnames of the talents in alphabetical order and he said the JPEG files are numbered by the alphabetical order that the talents were called for the photos. You were given a file of all the talents that were in the photoshoot (also 50 names). The names are not in alphabetical order. It is easy to rename files by typing this command as an example: ren dsc001.jpg Adam.jpg Manually doing so is prone to mistakes and your supervisor does not want to show the wrong picture in the web site. Because you just finished learning C++ programming, you are confident to write a new program that will do the following: 1. Read the names.txt file and save each name in string array. 2. Sort the array in alphabetical order. Choose a sorting algorithm that you have learned in class. You can use either the bubble sort or the selection sort. Remember that you need a swap function for sorting. 3. After the string array is sorted, use cout to send an output to the console of the rename command for each file. Example: If Jenny is the 7th talent in the list, the output should be "ren dsc007.jpg Jenny.jpg" here is the textfile name.txt
You started working for a talent agency. Your supervisor gave you a job to rename 50 files saved in a photographer's folder and the filenames start with dsc001.jpg thru dsc050.jpg. The photographer used a list on a printout of the firstnames of the talents in alphabetical order and he said the JPEG files are numbered by the alphabetical order that the talents were called for the photos.
You were given a file of all the talents that were in the photoshoot (also 50 names). The names are not in alphabetical order.
It is easy to rename files by typing this command as an example: ren dsc001.jpg Adam.jpg
Manually doing so is prone to mistakes and your supervisor does not want to show the wrong picture in the web site.
Because you just finished learning C++ programming, you are confident to write a new program that will do the following:
1. Read the names.txt file and save each name in string array.
2. Sort the array in alphabetical order. Choose a sorting
3. After the string array is sorted, use cout to send an output to the console of the rename command for each file.
Example: If Jenny is the 7th talent in the list, the output should be "ren dsc007.jpg Jenny.jpg"
here is the textfile name.txt


Trending now
This is a popular solution!
Step by step
Solved in 2 steps









