/*
*Copyright (c) 2014 ,烟台大学计算机学院
*All right reserved.
*文件名称:M$pszi$y是什么意思.cpp
*作 者:王伟诚
*完成日期:2014年11月03日
*版 本 号:1.0
*
*问题描述:M$pszi$y是什么意思
*问题输入:M$pszi$y
*问题输出:M$pszi$y的意思
*/
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char ch;
while((ch=getchar())!='\n')
{
putchar(ch-4);
}
return 0;
}
将M$pszi$y加密 , 只有从1-9中输入一个正确的数字,M$pszi$y的意思才能显示出来
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char ch;
int n;
cin>>n;
while((ch=getchar())!='\n')
{
putchar(ch-n+1);
}
return 0;
}
该程序只有输入5M$pszi$y,才能解密。
小刚想偷看两人的对话,写了一个解密程序,改程序能将各种可能列出来,总有一个是正确的。
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char ch;
int n;
while((ch=getchar())!='\n')
{
for(n=1;n<=9;n++) putchar(ch-n);
cout<<endl;
}
return 0;
}