Question: Output: James Q2Write a C++ program that reads a list of words from a text file into a vector of strings, sorts the words in

 Output: James Q2Write a C++ program that reads a list ofwords from a text file into a vector of strings, sorts the

words in descending alphabetical order, and then writes the sorted list to

Output:

James

Q2Write 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 Ted Raachel Paula Paula Helen Jim Rachel Helen Hint: You may use bubble sort (from lecture or selection sort (from homework 3). However, 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 , respectively. Use file input and output streams to read from and write to the files (make sure to include )

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!