
November 7th, 2012, 08:46 AM
|
|
Registered User
|
|
Join Date: Nov 2012
Posts: 1
Time spent in forums: 34 m 55 sec
Reputation Power: 0
|
|
Lab Help
Write a Raptor program that reads text from a file and encodes the file by adding 5 to the ASCII value of each character.
Put a text file (such as plain.txt) in the same directory as your Raptor program. Look under advanced topics in the Raptor help system for information on reading and writing to files.
Your Raptor program should:
1.Read the text file one line at a time.
2.Change each character of the string by adding 5 to it.
3.Write the encoded string to a second file, such as plain.code
4.The encoded file should have the same structure as the original file, if the second line of the original file has 24 characters (including spaces) then there should be 24 characters on the second line of the encoded file (spaces will now look like '%').
Demonstrate your executable flowchart to your instructor. Print out and hand in your flowchart. Make sure your name is on the flowchart in a comment.
Once you have completed your flowchart, write a C++ program that reads text from a file and decodes the file by subtracting 5 from the ASCII value of each character. Note that the Raptor program will encode the file and the C++ program will decode it.
Put a coded file (such as plain.code) in the same directory as your C++ executable program. See chapter 12 in Starting out with C++ for information on reading and writing to text files.
Your C++ program should:
1.Read the text file one line at a time.
2.Change each character of the string by subtracting 5 from it.
3.Write the encoded string to a second file, such as plain2.txt
He gave me a sample input file- called as plain.txt which says in the file that This is a sample input file for COSC 1436 assignment #10. Your program should encode this
file by adding 5 to the AsCII value of each character in it.
In your encoded file the first character should be 'Y'. The
last character of the first line should be ';'. The encoded file should have 8 lines of text just like this one, but will be unreadable. The last character of the last line will be a '3'.
|