http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=399
字符解密。
题目已经说了,字符打印时候,出现ASCII码偏移,都查了单词,我还一开始就拿题目数据做字符码。。。真水。。。
ASCII码直接偏移7解决。
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
const int MAXN = 1000;
int main()
{
char str[MAXN];
memset(str, 0, sizeof(str));
while ( cin >>str )
{
for ( int i=0; i<strlen(str); i++ )
{
str[i] -= 7;
} // end for
cout <<str <<endl;
} // end while
return 0;
}