Description
Input
Output
Sample Input
START NS BFW, JAJSYX TK NRUTWYFSHJ FWJ YMJ WJXZQY TK YWNANFQ HFZXJX END START N BTZQI WFYMJW GJ KNWXY NS F QNYYQJ NGJWNFS ANQQFLJ YMFS XJHTSI NS WTRJ END START IFSLJW PSTBX KZQQ BJQQ YMFY HFJXFW NX RTWJ IFSLJWTZX YMFS MJ END ENDOFINPUT
Sample Output
IN WAR, EVENTS OF IMPORTANCE ARE THE RESULT OF TRIVIAL CAUSES I WOULD RATHER BE FIRST IN A LITTLE IBERIAN VILLAGE THAN SECOND IN ROME DANGER KNOWS FULL WELL THAT CAESAR IS MORE DANGEROUS THAN HE
#include <iostream> #include <cstring> using namespace std; int main() { int i; char a[10000],b[100]; char c[30]={'V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U'}; while (1) { cin >> b; cin.get(); if (strlen(b)==10) { break; } cin.getline(a,10000); for (i=0;a[i]!='\0';i++) { if (a[i]>='A'&&a[i]<='Z') { cout << c[a[i]-65]; } else { cout << a[i]; } } cout << endl; cin >> b; } return 0; }
原文地址:http://blog.csdn.net/zsc2014030403015/article/details/43484543