Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Using C++, 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:

image text in transcribed

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.

COSC 2336.S01 PROGRAM THREE ASSIGNMENT: Create a program, which will perform the following actions: 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: At the beginning will be a 4 byte integer having the number of strings in the file. 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). 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. The class will support methods with the following capabilities: Get will have one 4 byte integer parameter (the index of the string to retrieve) and one string parameter to be filled in with the string read. 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. 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. Test your class by allowing the user to enter the following from the keyboard: G followed by an integer to read and print the string at the requested index. 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. 3. 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.801 - 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. DUE: 6 Mar 2020 COSC 2336.S01 PROGRAM THREE ASSIGNMENT: Create a program, which will perform the following actions: 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: At the beginning will be a 4 byte integer having the number of strings in the file. 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). 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. The class will support methods with the following capabilities: Get will have one 4 byte integer parameter (the index of the string to retrieve) and one string parameter to be filled in with the string read. 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. 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. Test your class by allowing the user to enter the following from the keyboard: G followed by an integer to read and print the string at the requested index. 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. 3. 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.801 - 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. DUE: 6 Mar 2020

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

What items have multiple attributes?

Answered: 1 week ago