1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include <iostream>
using namespace std;
int main()
{
int x, i, j, a[8][8] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64};
for(i = 0; i <= 7; i = i + 1)
{
for(j = 0; j <= 7; j++)
cout<<a[i][j]<<"\t";
cout<<"\n";
}
cout<<"Considering this a chessboard, pick a place: ";
cin>>x;
if(x>18 && x<23 || x>26 && x<31 || x>34 && x<38 || x>42 && x<47)
{
cout<<a[x-15][x-16]<<", "<<a[x-19][x-16]<<", "<<a[x-16][x-15]<<", "<<a[x-18][x-15]<<", "<<a[x-19][x-18]<<", "<<a[x-18][x-19]<<", "<<a[x-16][x-19]<<", "<<a[x-15][x-18]<<endl;
}
system("pause");
return 0;
}
|