Hi there, I\'m trying to write a code to describe movement of knight in a chess
ID: 3624142 • Letter: H
Question
Hi there,
I'm trying to write a code to describe movement of knight in a chess game using two dimensional arrays!!
I have done it without using the array!! plz help me to convert it using arrays !!I need this as soon as possible please!!
here is my code:
#include
using namespace std;
int start;
int i,j;// declare two variables
int knight [8][8]; // declare two dimentional array to represent the chess board.
int main()
{
cout<cout<<"This is the Chess board !! ";
cout<
for( i=0; i<8; i++)
{
for(j=0; j<8;j++)
{
cout<<" "<cin>>i>>j;
cout<cout<<"you can move to ";
if (((i+1>0)&&(i+1<8))&&((j+2>0)&&(j+2<8)))
{
cout<}
if (((i+1>0)&&(i+1<8))&&((j-2>0)&&(j-2<6)))
{
cout<}
if (((i-1>0)&&(i-1<7))&&((j-2>0)&&(j-2<6)))
{
cout<}
if (((i-1>0)&&(i-1<7))&&((j+2>0)&&(j+2<8)))
{
cout<}
if (((i-2>0)&&(i-2<6))&&((j-1>0)&&(j-1<7)))
{
cout<}
if (((i-2>0)&&(i-2<6))&&((j+1>0)&&(j+1<8)))
{
cout<}
if (((i+2>0)&&(i+2<8))&&((j-1>0)&&(j-1<7)))
{
cout<}
if (((i+2>0)&&(i+2<8))&&((j+1>0)&&(j+1<8)))
{
cout<}
return 0;
}