Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- std::ifstream f("polybius.in");
- std::ofstream g("polybius.out");
- char a[6][6];
- int b[26];
- int main()
- {
- int T;
- f >> T;
- if(T==1){
- char t, z;
- for(int i=1; i<=5; i++)
- for(int j=1; j<=5; j++)
- {
- f >> t;
- b[t-'A']=10 * i + j;
- }
- while(f >> z)
- g << b[z-'A'];
- }
- if(T==2){
- char x, y, s;
- for(int i=1; i<=5; i++)
- for(int j=1; j<=5; j++)
- {
- f >> s;
- a[i][j] = s;
- }
- while(f >> x >> y)
- g << a[x-'0'][y-'0'];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement