#38720: c++


yp11251200@yphs.tp.edu.tw (701-26徐立權)

學校 : 臺北市私立延平高級中學
編號 : 239171
來源 : [203.72.178.1]
最後登入時間 :
2024-05-02 17:14:52
b516. 凱撒密碼-商競103 -- 103學年度商業類程式設計競賽模擬題 | From: [203.72.178.1] | 發表日期 : 2023-12-19 17:38

#include <iostream>
#include <string>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
 
int main(int argc, char** argv) {
int n;
string s;
cin>>n;
while(n--) 
{
cin>>s;
for(int i=0; i<s.size();i++)
{
if(s[i]=='X'||s[i]=='Y'||s[i]=='Z')s[i]-=23;
else s[i]+=3;
cout<<s[i];
}
cout<<endl;
}
return 0;
}
 
ZeroJudge Forum