编码和解码文本 [英] Encoding and Decoding Text

查看:86
本文介绍了编码和解码文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须编写一个这样的程序,但是我不太好.请有人帮我

在记事本中创建的文件,用于打开和读取并统计字母数字(多少个字母),数字和标点符号,控制标记和空白.

文件中的文本应按以下规则进行编码:编码和解码必须使用两种不同的功能来完成.
编码键:在文本中仅对字母和数字中的字母进行编码.字符串中的每个字母,用奇数个位置替换,该字母在替换字母后的第二位.因此,最后一个字母Y,Z将被替换为A,B.字符串中的Steam字母不会发生任何变化.
奇数字母将替换为其跟随者的Steam编号,奇数数字将替换为其Steam的前身. 9可以将0和0编码为9.控制标记和标点符号不会发生任何变化.像此文件一样,以不同的名称保存并称为解码.

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.

推荐答案

作业和Gimmecode在同一问题中...:rolleyes:

好吧...

-熟悉如何打开和使用文件...
-学习了如何打开文件后,请阅读内容.
-您将需要使用气泡,插入器(2模运算将告诉您它是偶数还是奇数).
-如果逐个字符地进行调用,则调用函数进行替换应该很容易.
-您将需要一个字符串来存储编码后的文本.
-然后您必须将该文本写入新文件...


这是一个不错的作业...学习基础知识很有趣又有趣...

尝试并享受它的乐趣...请记住,了解这些知识是使任何IT都能正常工作的最低要求,因此更好地学习它...

HTH! :thumbsup:
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:


您应该做自己的作业,并在遇到困难时在这里问一些具体问题(您没有读过FAQ,对吗?).
毕竟,要求很明确,因此任务应该很简单.
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.


这篇关于编码和解码文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆