高中生程式解題系統:解碼器(Decode)

若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。

題目連結 http://zerojudge.tw/ShowProblem?problemid=a009。此題用字元的 ASCII Code 來運算即可,而整數K到底是多少呢?


程式碼:

#include <iostream>
using namespace std;
int main()
{
int k = -7;
char ch;
while( cin.get(ch) )
{
if( ch != '\n' )
ch = ch + k;
cout << ch;
}
return 0;
}
view raw a009.cpp hosted with ❤ by GitHub

沒有留言: