Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I have to write a program like this, but I'm not that good. Please someone help me

Created file in notepad, to open and read and to make statistic for letter number (how many letters), numbers and punctuation marks, control marks and empty spaces.

The text in the file should be encoded by the rule: encoding and decoding to be done with two different functions.
Key of coding: in the text to encode only the letters from the alphabet and the numbers. Every letter in the string, which is odd position to be replaced with the letter who is two places after the replacing letter in the alphabet. The last letters Y,Z to be replaced with A,B consequently. Steam letters in the string do not suffer any changes.
Odd letters numbers to be replaced with steam numbers who are their followers and odd numbers to be replaced with their steam predecessors. 9 to encode 0 and 0 with 9. Control marks and punctuation marks do not suffer any changes. Treated like this file to be saved under a different name and be called decode.
Posted
Updated 10-May-11 14:55pm
v3
Comments
Niklas L 10-May-11 9:28am    
Don't add comments as solutions. Either click on the 'Add comment' link below an answer if you want to reply to it, or hit 'Improve question' if you have more info you want to share.

Homework and Gimmecode in the same question... :rolleyes:

Well...

- Get familiar on how should you open and work with files...
- Once you've learnt how to open files, read the content.
- You will need to use a bucle, an interator (the one that a 2 modulus operation will tell you if it is even or odd).
- Calling a function to make the replacement should be easy if you do it char by char...
- You will need a string to store the encoded text.
- Then you will have to write that text into a new file...


This is a nice homework... fun and interesting to learn the basics...

Try it and enjoy doing it... keep in mind that knowing those things are the minimum to make any IT work out there so better learn it well...

HTH! :thumbsup:
 
Share this answer
 
Comments
Marc A. Brown 10-May-11 11:26am    
Nice answer.
Joan M 10-May-11 11:38am    
Thank you Marc!
You should do your own homework and ask here just specific questions when you are stuck (you didn't read the FAQ, did you?).
After all, the requirements are clear hence the task should be straightforward.
 
Share this answer
 
Comments
Niklas L 10-May-11 9:23am    
Comment from OP:
"no i didn't..
it should be done till friday..
if someone know please write"

"i'll try something,
when i stuck somewhere i'll post here"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900