Lab 7
Lab 7
Objective: The purpose of this lab is to practice working with std::vector in C++.
Use the following reference to finish the tasks listed below
https://www.w3schools.com/cpp/cpp_ref_vector.asp
return 0;
}
• Create a vector of strings called words and initialize it with values such as {"apple", "banana", "cherry",
"date"}.
• Add "elderberry" to the vector.
• Sort the vector in alphabetical order.
• Search for "cherry" and print its position in the vector.
• Remove "banana" from the vector and print the final list of words.
Submission:
You need to upload to Moodle: the source code (.cpp files), and the screenshot of the running of your program.