Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <cstring>
- #include <sstream>
- #include <string>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int i,n,j,chi,chj;
- string b,bu,etalon,TWOHEAD;
- n=8;
- vector<vector<char>> a(n, vector<char>(n,'.'));
- cin >> b;
- etalon="abcdefgh";
- bu=b[0];
- TWOHEAD=b[1];
- chi=stoi(TWOHEAD);
- chj=etalon.find(bu);
- chi=n-chi;
- a[chi][chj]='K';
- if (chj+1<n & chi-2>=0)
- a[chi-2][chj+1]='*';
- if (chj-1>=0 & chi-2>=0)
- a[chi-2][chj-1]='*';
- if (chj+2<n & chi-1>=0)
- a[chi-1][chj+2]='*';
- if (chj+2<n & chi+1<n)
- a[chi+1][chj+2]='*';
- if (chj+1<n & chi+2<n)
- a[chi+2][chj+1]='*';
- if (chj-1>=0 & chi+2<n)
- a[chi+2][chj-1]='*';
- if (chj-2>=0 & chi+1<n)
- a[chi+1][chj-2]='*';
- if (chj-2>=0 & chi-1>=0)
- a[chi-1][chj-2]='*';
- for(i=0;i<n;++i)
- {
- for(j=0;j<n;++j)
- cout<<a[i][j] << " ";
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement