Guest User

Untitled

a guest
Jun 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int trans1 (char c){
  8. if (c=='D') return 1;
  9. if (c=='C') return 2;
  10. if (c=='B') return 3;
  11. if (c=='A') return 4;
  12. }
  13.  
  14. char trans2 (int n){
  15. if (n==1) return 'D';
  16. if (n==2) return 'C';
  17. if (n==3) return 'B';
  18. if (n==4) return 'A';
  19. }
  20.  
  21. int main(){
  22. char c,cc;
  23. int x,y,;
  24. cin>>c>>x;
  25. y=trans1 (c);
  26. if ((y>6)or(y<1)or(x>6)or(x<1)) cout<<"?"<<endl;
  27. else{
  28. if ((y-1)>=1) cout<< trans2 (y-1)<<x<<endl;
  29. else cout<<"--"<<endl;
  30. if ((x+1)<=6) cout<<c<<x+1<<endl;
  31. else cout<<"--"<<endl;
  32. if ((y+1)<=4) cout<<trans2 (y+1)<<x<<endl;
  33. else cout<<"--"<<endl;
  34. if ((x-1)>=1) cout<<c<<x-1<<endl;
  35. else cout<<"--"<<endl;
  36. }
  37. system("pause");
  38. }
Add Comment
Please, Sign In to add comment