Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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 includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started