Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream> #include <cstring> #include <fstream> using namespace std; ifstream f("polybius.in"); ofstream g("polybius.out"); char t[26],ca,cb; unsigned int i,j,x,y,nr; int task; int main() { f>>task; f.get(); f.getline(t,26); if(task==1) { while(f.get(ca)) for(j=0;j<25;j++) { if (ca==t[j]) { nr=(j/5 +1)*10 + j%5+1; g<<nr; break; } } } else { while(f.get(ca)) { f.get(cb); x=(int)ca-48; y=int(cb-48); if(x<=5) g<<t[(x-1)*5 +y-1]; } } return 0; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement