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]='Q';
- for (i=0;i<n;++i)
- {
- for (j=0;j<n;++j)
- {
- if (j==chj)
- a[i][j]='*';
- if (i==chi)
- a[i][j]='*';
- if (abs(i-chi)==abs(j-chj))
- a[i][j]='*';
- }
- }
- a[chi][chj]='Q';
- for(i=0;i<n;++i)
- {
- for(j=0;j<n;++j)
- cout<<a[i][j] << " ";
- cout<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment