How do fixed-sized data fields aid in random file access


Assignment

Random File Access

• Discuss in detail the difference in the process of sequential file access and random file access.
• Also, explain the advantage of fixed-sized data fields over variables sized fields.
• How do fixed-sized data fields aid in random file access?
• Explain a situation where you would use the unget function while reading data from a text file.

Encryption Using File Streams

Part A

Complete the following questions:

1. Write C++ code to open a document with the name Hello.txt, place the message "Hello, World!" in the document, and exit the document. Re open the file you closed, and read the message into a string variable. Exit out of the file.

2. When do you open the file as an ifstream, as an ofstream, or as an fstream? Could you simply open all files as an fstream?

3. Why is the ifstream parameter of the read_data procedure in the previous question a reference parameter and not a value parameter?

4. What is the difference between a text file, and a binary file?

Part B

Random monoalphabet cipher.

The caeser cipher, which shifts all letters by a certain amount, is easy to decipher. Try this, instead of numbers use letters. Consider this, the word is FEATHER. Remove duplicate letters, making FEATHR, and append the rest of the letters of the alphabet in reverse order.

Now encrypt the letters as follows:

See exhibit A

Now, write a program that encrypts or decrypts a file using this cipher.

For example,

crypt -d -kFEATHER encrypt.txt output.txt
decrypts a file using the keyword FEATHER. You must always supply a keyword.

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: How do fixed-sized data fields aid in random file access
Reference No:- TGS02957416

Now Priced at $70 (50% Discount)

Recommended (94%)

Rated (4.6/5)