#34670: 提示:這題可以用cstring的函式


yodayo (余)

學校 : 不指定學校
編號 : 229562
來源 : [116.241.74.217]
最後登入時間 :
2024-04-04 22:05:03
a009. 解碼器 -- ACM 458 | From: [114.26.143.83] | 發表日期 : 2023-04-06 20:17

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    string msg = "";
    while (getline(cin, msg))
   {
        char arr[msg.length() + 1];
        strcpy(arr, msg.c_str());
        for (int i = 0; i < msg.length(); i++)
           arr[i] -= 7;
       for (int i = 0; i < msg.length(); i++)
           cout << arr[i];
        cout << endl;
    }
}

 
ZeroJudge Forum