if statement

I am building a game name Othello and my problem is that when i get to b==3 and their is a piece at the location stating b=2; doesn't send my code back up the if statement! Please help.
my input is 0 for pass, then coordinates x=4 y=4 and that location is filled already
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
65
66
67
68
69
70
71
72
73
  int b=1;
    int x=0;
    int y=0;
    gotoxy(62,11);
    cout<<"PASS:( )";
    while(b!=0)
    {
        int p=1;
        int an=1;
        if(b==1)
        {
            while(an==1)
            {
                display();
                if(p%2==0)
                {
                    stat(1);
                }
                else
                {
                    stat(0);
                }
                gotoxy(68,11);
                cin>>an;//0 means no and 1 means yes
                p++;
            }
            b=2;
        }
        else if(b==2)
        {
            while(inRange(x,y)==0)
            {
                gotoxy(65,15);
                cin>>x;
                gotoxy(69,15);
                cin>>y;
                if(inRange(x,y)==0)
                {
                    gotoxy(65,16);
                    cout<<"Again!";
                    gotoxy(65,15);
                    cout<<" ";
                    gotoxy(69,15);
                    cout<<" ";
                }
            }
            b=3;
        }
        else if(b==3)
        {
            if(pieceAtLoc(x,y)==1)
            {
                b=2;
            }
            else
            {
                b=4;
            }
        }
        else if(b==4)
        {
            SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | 2);// X turn
            gotoxy(65,20);
            cout<<"done";
            SetConsoleTextAttribute( GetStdHandle(STD_OUTPUT_HANDLE), 15);
            b=0;
            /*if(valid)
            {

            }*/
        }

    }
Last edited on
Topic archived. No new replies allowed.