Explore BrainMass

A C++ program that shows how to read files

Write a program that uses the attached data file as input and does simple data encryption. Replace each letter of the alphabet with the next letter. For example, a will be replace by b and b will be replaced by c. The letter z will be replaced by a. Numbers, spaces, punctuation and special characters stay the same. The sentence: "I am 21 yrs. old!", translates to J bn 21 zst. ome! Print out the input and print out the encrypted sentence.

Please do this the easiest way possible, I am learning C++ by myself but I just don't understand input/output so this will help me understand it better.

The contents of the data file are:

Roses are red
Violets are blue
I am still 21 years old!
The quick brown fox
Jumps over the lazy dog


Solution Preview

This solution shows how to read characters from a file, do some basic
processing, and output the characters. When processing data from a
file there are always three steps 1) open the file, 2) process the
data in the file, 3) close the file. This is exactly ...

Solution Summary

This solution provides a simple but complete C++ program that reads a file and do some simple string processing on the data from that file.