###### tags: Basic - [x] check # a009: 解碼器 :::info 在密碼學裡面有一種很簡單的加密方式,就是把明碼的每個字元加上某一個整數K而得到密碼的字元(明碼及密碼字元一定都在ASCII碼中可列印的範圍內)。例如若K=2,那麼apple經過加密後就變成crrng了。解密則是反過來做。這個問題是給你一個密碼字串,請你依照上述的解密方式輸出明碼。 至於在本任務中K到底是多少,請自行參照Sample Input及Sample Output推出來吧!相當簡單的。 | input | output | | -------- | -------- | | 1JKJ'pz'{ol'{yhklthyr'vm'{ol'Jvu{yvs'Kh{h'Jvywvyh{pvu5 | *CDC is the trademark of the Control Data Corporation. | ::: >1. Use the standard C language function 'getchar' to get each input character. >2. When user input enter, the character will save in the buffer and waiting putchar() to read(only read one character). >3. Through input and output exsample and ASCII, we can find input-7=output. >4. We can use a while loop to control the test data. ```=c #include <stdio.h> int main() { char c; while(1){ c=getchar(); if(c=='\n'){ break; } else{ c=c-7; putchar(c); } } return 0; } ```=