Advertisement
Luckytoef

Untitled

May 26th, 2020
884
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. std::ifstream f("polybius.in");
  4. std::ofstream g("polybius.out");
  5.  
  6. char a[6][6];
  7. int b[26];
  8. int main()
  9. {
  10.     int T;
  11.     f >> T;
  12.     if(T==1){
  13.         char t, z;
  14.         for(int i=1; i<=5; i++)
  15.             for(int j=1; j<=5; j++)
  16.             {
  17.                 f >> t;
  18.                 b[t-'A']=10 * i + j;
  19.             }
  20.         while(f >> z)
  21.             g << b[z-'A'];
  22.     }
  23.     if(T==2){
  24.         char x, y, s;
  25.         for(int i=1; i<=5; i++)
  26.             for(int j=1; j<=5; j++)
  27.             {
  28.                 f >> s;
  29.                 a[i][j] = s;
  30.             }
  31.         while(f >> x >> y)
  32.             g << a[x-'0'][y-'0'];
  33.     }
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement