Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the following in beginner C++ code. Comment when necessary Write a program that creates an empty vector of strings called V. Vector V

Please write the following in beginner C++ code. Comment when necessary image text in transcribed
Write a program that creates an empty vector of strings called V. Vector V grows and shrinks as the user processes commands from a data file called "vectorData.txt Each line in the transaction file contains a command and the coresponding data. For example, you may have the following information in your file: Insert Delete Print Hello The transaction file can only include three types of commands: Insert Delete, and Print. Insert command inserts a string value in the vector at a specific position. So the Insert command comes with two more information, the string you need to insert and the position it should be inserted at. For example, the first line indicates that the word Hello" should be inserted in VI4]. You should check if this insert is possible. It is possible if the position you are attempting to insert the element is a positive number not beyond the size of the vector Delete command deletes the clement at the specified position. So Delete comes with one more information that indicates which element (index) should be deleted. For example, The second line means V[5] should be removed. Again this operation should only be allowed if the index is positive and not beyond the current size of the vector . Print command prints the contents of the vector on the screen. You may test your program with the following data fike Delete Insert Insert Insert Insert Insert Insert Insert Insert Insert Delete Insert Delete Insert Delete Print 0 Students Helcome Back Ready Get To Progr Very Good Job Cs211 Sample Output: Welcome CS211 Students Very Good Job Note: Each command must be implemented in a separate function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Fundamentals Study Guide

Authors: Dr. Sergio Pisano

1st Edition

B09K1WW84J, 979-8985115307

More Books

Students also viewed these Databases questions

Question

16. How do we denote power? (a) a (b) b (c) 1 - a (d) 1 - b

Answered: 1 week ago

Question

=+f. Does it promise a benefit or solve a problem?

Answered: 1 week ago

Question

=+ Why do some seem like a personalized, individual message?

Answered: 1 week ago