Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is supposed to be written in c++. The vectoryData.txt file includes the following text, formatted exactly like this: Delete -1 Insert Students 0
This is supposed to be written in c++. The vectoryData.txt file includes the following text, formatted exactly like this:
"
Delete -1 Insert Students 0 Insert Welcome 0 Insert Back 1 Insert Ready 5 Insert Get -1 Insert To 6 Insert Program 3 Insert Very 3 Insert Good 4 Delete 1 Insert Job 4 Delete 7 Insert CS211 1 Delete 6 Print
"
Please be detailed with your work, and make sure the instructions are followed correctly. I will upvote anyone who completes this, but it has to be done right.
Write as many comments as you can so i can follow along. Thank you.
Program 2 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 corresponding 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 V[4]. 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 bevond the size of the vector Delete command deletes the element 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 file: Delete Insert Insert Insert Insert Insert Insert Insert Insert Insert Delete Insert Delete Insert Delete Print Students Welcome Back Ready Get To Program Very Good Job CS211 Sample Output: Welcome CS211 Students Very Good Job Note: Each command must be implemented in a separate functionStep 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