Hello all!
I'm having trouble with my homework assignment - I've been working on it for hours and have gotten it down to one syntax error and then I think it will compile so I can move on, I just can't seem to figure out what the problem is. Here is my code.... THANKS!!
#include <iostream>
#include <string>
using namespace std;
int main()
{
unsigned int board = 511;
unsigned int mask = 256;
int i, j;
int number;
do {
cout << "Press a number [1-9 or 0 to quit]:";
cin>> number;
switch (number)
{
case 1: board = board ^ 416; // if (input == 1) then (switch 1,2,4)
break;
case 2: board = board ^ 464; // if (input == 2) then (switch 1,2,3,5)
break;
case 3: board = board ^ 200; // if (input == 3) then (switch 2,3,6)
break;
case 4: board = board ^ 308; // if (input == 4) then (switch 1,4,5,7)
break;
case 5: board = board ^ 186; // if (input == 5) then (switch 2,4,5,6,8)
break;
case 6: board = board ^ 89; // if (input == 6) then (switch 3,5,6,9)
break;
case 7: board = board ^ 38; // if (input == 7) then (switch 4,7,8)
break;
case 8: board = board ^ 39; // if (input == 8) then (switch 4,7,8,9)
break;
case 9: board = board ^ 11; // if (input == 9) then (switch 6,8,9)
break;
}
for (i=0; i<3; i++)
{
for (j=0; j<3; j++)
{
if ((board & mask) == 0) cout << "0";
else cout << "1";
mask = mask >> 1;
}
while (board!=0); }
{
if (board == 0)cout << "YOU WIN" << endl;
}
cout << endl;
}
return 0;
}