Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int castleX, castleY, queenX, queenY;
- do
- {
- cout << "enter the Knight X and Knight Y\n";
- cin >> castleX >> castleY;
- cout << endl;
- } while (castleX>8 || castleX<=0 || castleY>8 || castleY<=0);
- do
- {
- cout << "enter the Queen X and Queen Y\n";
- cin >> queenX >> queenY;
- cout << endl;
- } while (queenX > 8 || queenX <= 0 || queenY > 8 || queenY <= 0);
- cout << "the Castle" << castleX << ";" << castleY << ")\n";
- cout << "the Queen (" << queenX << ";" << queenY << ")\n";
- cout << endl;
- if (castleX == queenX || castleY == queenY)
- cout << "the Castle bites the Queen\n";
- else
- cout << "the Castle doesn't bites the Queen\n";
- if(castleX == queenX || castleY == queenY || castleX - castleY ==queenX - queenY)
- cout << "the Queen bites the Castle\n";
- else
- cout << "the Queen doesn't bites the Castle\n";
- cout << endl;
- if (castleX + 1 == queenX || castleX - 1 == queenX || castleY + 1 == queenY || castleY - 1 == queenY)
- cout << "the Castle bites the Queen in one move\n";
- else
- cout << "the Castle doesn't bites the Queen in one move\n";
- if (castleX + 1 == queenX || castleX - 1 == queenX || castleY + 1 == queenY || castleY - 1 == queenY ||
- castleX - castleY +1 == queenX - queenY || castleX - castleY - 1 == queenX - queenY)
- cout << "the Queen bites the Castle in one move\n";
- else
- cout << "the Queen doesn't bites the Castle in one move\n";
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement