using
Code:
int ExecuteCommand(int com[], int max)
{
int Tfloor[FLOORSIZE][FLOORSIZE];
int i, move, penup, pendown, n, s, e=1, w;
for(i=0;i< max;i++)
{
switch (com[i]) {
case 1:
cout << "penup\n";
penup=1;
break;
case 2:
cout << "pendown\n";
pendown =1;
break;
case 3:
cout << "right\n";
w=1;
break;
case 4:
cout << "left\n";
e=1;
break;
case 5:
// case 5 .. uses
//com[i + 1] to get the value of how many spaces to move..
// assuming i know wat direction i wanna go..
// i put an if statement.. and then how do i fill an array..
// i have to convert pendown to 1s and pen up to 0..
// do i make sense....
Tfloor[FLOORSIZE][FLOORSIZE]=; // how do i fill an array..
DisplayFloor(Tfloor, FLOORSIZE)
break;
}
}
}
how do i convert the above to something like this and put it into
int Tfloor[FLOORSIZE][FLOORSIZE] = {1, 1, 1, 1, 1,
0, 0, 0, 0, 0};
until the end of the loop..
its similar to turtle graphics
ta..