my programm is acting up

here is my code:
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include <cstdlib>
#include <iostream>
#include <windows.h>

using namespace std;

//MAP
char Map[10][20] = { "###################",
                     "#@                #",
                     "#########    +    #",
                     "#       #         #",
                     "#       #         #",
                     "#        +        #",
                     "#             +   #",
                     "#                 #",
                     "###################" };
int PlayerX, PlayerY;
int Hp = 10;
int HpMax = 20;
bool end = false;       
int GameSpeed = 200;

int main(int argc, char *argv[])
{
    while(end == false)
    {
              if (Hp > HpMax)
              {
                     Hp = HpMax;
                     }
               system("cls");
               for (int y = 0; y , 10; y++)
               {
                   cout << Map[y] << endl;
               }
               
               cout << "X : " << PlayerX << endl;
               cout << "Y : " << PlayerY << endl;
               cout << "HP: " << Hp << "/" << HpMax << endl;
               for (int y = 0; y < 10; y++)
               {
                   for (int x = 0; x < 20; x++)
                   {
                       switch(Map[y][x])
                       {
                                        case '@':
                                             {   
                                                 if(GetAsyncKeyState(VK_UP) != 0)
                                                 {
                                                         int y2 = (y - 1);
                                                         switch(Map[y2][x])
                                                         {
                                                                           case ' ':
                                                                           {
                                                                                Map[y][x] = ' ';
                                                                                y -= 1;
                                                                                Map[y2][x] = '@';
                                                                           }break;
                                                                           case '+':
                                                                                {
                                                                                   Hp += 5; 
                                                                                }break;
                                                         }
                                                 }  
                                                 if (GetAsyncKeyState(VK_DOWN) != 0)
                                                 {
                                                         int y2 = (y + 1);
                                                         switch(Map[y2][x])
                                                         {
                                                                           case ' ':
                                                                           {
                                                                                Map[y][x] = ' ';
                                                                                y += 1;
                                                                                Map[y2][x] = '@';
                                                                           }break;
                                                                           case '+':
                                                                                {
                                                                                   Hp += 5; 
                                                                                }break;
                                                         }
                                                 }  
                                                 if (GetAsyncKeyState(VK_LEFT) != 0)
                                                 {
                                                         int x2 = (x - 1);
                                                         switch(Map[y][x2])
                                                         {
                                                                           case ' ':
                                                                           {
                                                                                Map[y][x] = ' ';
                                                                                x -= 1;
                                                                                Map[y][x2] = '@';
                                                                           }break;
                                                                           case '+':
                                                                                {
                                                                                   Hp += 5; 
                                                                                }break;
                                                         }
                                                 }  
                                                 if (GetAsyncKeyState(VK_RIGHT) != 0)
                                                 {
                                                         int x2 = (x + 1);
                                                         switch(Map[y][x2])
                                                         {
                                                                           case ' ':
                                                                           {
                                                                                Map[y][x] = ' ';
                                                                                x += 1;
                                                                                Map[y][x2] = '@';
                                                                           }break;
                                                                           case '+':
                                                                                {
                                                                                   Hp += 5; 
                                                                                }break;
                                                         }
                                                 }  
                                             PlayerX = x;
                                             PlayerY = y;
                                             }break;
                                        case '+':
                                        {
                                             
                                        }break;
                       }
                   }
               }
               Sleep(GameSpeed);
    }
    return 0;
}

when the program is compiled it just stops working could someone please tell me where i went wrong thank you to anyone who help.
This doesn't look right: for (int y = 0; y , 10; y++)
Should it be for (int y = 0; y < 10; y++)?
Topic archived. No new replies allowed.