7-4 replacement string (15 points)
This problem requires programming, given the string of capital letters corresponding to the following replacement rule:
Original letter in the letter
AZ
BY
the CX
DW
... ...
XC
YB
ZA
input format:
Enter a given line does not exceed 80 characters, carriage return and the end of the string.
Output format:
replacement string given output row is completed.
Sample input:
Only The Capital Letters. 11 are REPLACED.
Output Sample:
Lnly The XZKRtaO OeGtVIH are REPLACED. 11.
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
char b[81];
char a[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int i=0,c;
cin.getline(b,81);
c=strlen(b);
for(i=0;i<c;i++)
{
for(int j=0;j<=25;j++)
{
if(b[i]==a[j])
{
b[i]=a[25-j];
break;
}
}
}
for(int i=0;i<c;i++)
cout<<b[i];
return 0;
}