Starting from:

$30

DS-Mini-Assignment 4 STL Vector Solved

Create a program that stores words in an STL vector and then searches the vector for words.

Requirements

You will keep track of strings as C++ string objects.

In main, declare a vector variable to contain your strings. 

Create a loop that gets one word at a time from the user until they enter "." as the only thing on the input line. For this assignment, it is adequate to limit strings to one word at a time. Put the word into the vector.

Once the user is done entering words, set up a separate loop to search for words in the vector. Similar to the previous loop, get the searchable words one at a time until they enter ".". When you find the word, use printf() (or cout) to display "Success!".  If you don't find the word, use printf() (or cout) to display "Not there!". 

You should comment as normal

More products