Question: Q2) Write a C++ program that reads a list of words from a text file into a vector of strings, sorts the words in descending

 Q2) Write a C++ program that reads a list of words

Q2) Write a C++ program that reads a list of words from a text file into a vector of strings, sorts the words in descending alphabetical order, and then writes the sorted list to another text file. Assume that both the input and output files are formatted with only one word on each line. An example file input /file output pair is provided below: Input file: Output file: Jim Ted Paula Helen Rachel Ted Raachel Paula Helen Hint: You may use bubble sort (from lecture) or selection sort (from homework 3). Howeve you must rewrite the sorting algorithm to work on a vector of strings. Note: You must write your code in a source file named sort list.cpp. In your code, you must read from a text file named list in.txt and write to a text file named list out.txt. You are provided an example input text file to test your code. Use the string and vector types that are accessible when you include and )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!