Question
Create a c++ program that stores words in an STL vector and then searches the vector for words. Requirements You will keep track of strings
Create a c++ 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.
Step 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