Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program, which will perform the following actions: 1. Create a class to control manipulation (input and output) of a random access file containing

Create a program, which will perform the following actions:

1. Create a class to control manipulation (input and output) of a random access file containing of set of text strings of varying length with the following format:

a) At the beginning will be a 4 byte integer having the number of strings in the file.

b) At the end will be an array of pairs of integers (streamoff for the offset from the beginning of the file to the start of the corresponding string and size_t bytes for the length of the string in bytes).

c) The number at the beginning will be followed by a set of strings of text. There is no special termination character at the end of a string.

2. The class will support methods with the following capabilities: a) Get will ha ve one 4 byte integer parameter (the index of the string to retrieve) and one string parameter to be filled in with the string read.

b) Replace will have one 4 byte integer parameter (the index of where the string will be written) and one string parameter containing the string to write. If the index to write is larger than the current largest index, insert a series of zero value indices (to indicate empty strings) into the array.

c) Insert will have the same parameters as Replace but instead of writing over an index, it will move all indices from the insert point on down by one and write the new string into the new space.

3. Test your class by allowing the user to enter the following from the keyboard:

a) G - followed by an integer to read and print the string at the requested index.

b) R - followed by an integer and a string to write a string at the requested index.

c) I - followed by an integer and a string to insert a string at the requested index.

TURN IN:

1) An electronic copy of the .cpp and .h files in the project folder as created by Visual Studio. This will be emailed to the instructor with the subject line COSC 2336.S01 Program 3.

2) If you wish any feedback on your work, turn in a printed listing of the .cpp and .h files that you created.

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_2

Step: 3

blur-text-image_3

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

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions

Question

Describe posttraumatic stress disorder.

Answered: 1 week ago