View the step-by-step solution to:

Part 1 Write a program that opens a local file C:\DataDirectory\data.txt reads in the data into your program without removing the data from the file...

Programming in C++:

Write a program that opens a local file C:DataDirectorydata.txt reads in the data into your program without removing the data from the file and appends new data onto the end of the existing data in the program, and then appends the new data onto the existing data within the file.
For example, if the data file originally contained the following data:

Hello

Then when your program is done, it should say:

HelloHello my name is Bob

Also, you must utilize exception handing technique to validate that the file has been open, and offer the user a chance to enter a correct filename until the file is found.

Hint: Use the overloaded open functions, or use random access methodology.


***must provide comments throughout entire code as if it were the instructor's first time.  Code cannot be previously used by another student***

Please see attachment Parts 1 and 2 are to be completed please

Part 1 Write a program that opens a local fle C:\DataDirectory\data.txt reads in the data into your program without removing the data From the fle and appends new data onto the end oF the exisTng data in the program, and then appends the new data onto the exisTng data within the fle. ±or example, iF the data fle originally contained the Following data: Hello ²hen when your program is done, it should say: HelloHello my name is Bob Also, you must uTlize excepTon handing technique to validate that the fle has been open, and o³er the user a chance to enter a correct flename unTl the fle is Found. Hint: Use the overloaded open FuncTons, or use random access methodology.
Background image of page 1
Part 2. LeTer frequencies. If you were to encrypt a Fle using the cipher of Exercise P9.2, the leTers will mixed up, and will appear as that you cannot decrypt it without the keyword. Also, it would seem illogical to try and guess the keyword, but someone who is trained in decryp±on would have no trouble breaking the cipher. ²he average leTer frequencies of English leTers are common knowledge. ²he most common leTer E, occurs about 13% of the ±me. 1. See Exhibit B. 2.Write a program that reads as an input Fle and shows the leTer frequencies in the Fle. ²his tool is invaluable to a code breaker. If the most frequent leTers are H and K there is a high probability that they are the encryp±ons of E and ². (op±onal) 1.Expand on your 9.3 project to add components that either aide in prin±ng out a deciphered message, or to automa±cally aTempt to output
Background image of page 2
Sign up to view the entire interaction

Top Answer

Please find attached... View the full answer

part1.cpp

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
string fileName = "C:\\DataDirectory\\data.txt";
string content =...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online