问题是这样的,但是我不能做5号弦的反转。
句子要加密如下。在
•将句子作为字符串读入,称为string1。在
•使用循环创建string2。它是没有空格的string1。在
•使用循环创建string3。它包含字符串1中的所有字符,每四个字符后加一个空格。在
•使用循环创建string4。每个字符都被字母表中的下一个字符替换,空格被“*”替换,“Z”或“Z”被“a”或“a”替换
•使用循环或嵌套循环(循环内的循环)创建string5。每组四个字符中用“*”隔开的字符颠倒过来。在
例如If string1=“猫坐在垫子上”string2 = “Thecatsatonthemat”
string3 = “Thec atsa tont hema t”
string4 = “Uifd*butb*upou*ifnb*u”
string5 = “dfiU*btub*uopu*bnfi*u”
我已经做过了,但是第五行不行:
^{pr2}$
这是程序运行时得到的结果:Enter sentence: The cat sat on the mat
u*bnfi*uopu*btub*dfiU
string 1 = The cat sat on the mat
string 2 = Thecatsatonthemat
string 3 = Thec atsa tont hema t
string 4 = Uifd*butb*upou*ifnb*u
string 5 = u*bnfi*uopu*btub*dfiU