Help with declaring get

Hello everyone this is my first forum post and i have a question for all of you. I have beenlearning c++ along with flash html and c# for a little over three months now, and i started programming a console rpg and when i go to run it the 48th line comes up as an error saying'Get' undeclared (first use this function)
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
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <conio.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(Get AsyncKeyState(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 (Get AsyncKeyState(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 (Get AsyncKeyState(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 (Get AsyncKeyState(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;
}

try running it in your compiler and see if you can figure it out thnakyou and have a nice day
What exactly is "Get"? Just out of curiosity, though, because it makes no difference.

if() checks a condition. In this case, I'm guessing you want to check whether the return value of "AsyncKeystate(VK_Right)" is 0 (false). I'm not sure where you got the idea to use "Get", but it doesn't mean anything in C++.

Either it's part of the function name (in which case there wouldn't be a space after Get), or it's some keyword of one of the other languages.

Here, you either check a variable (by using "variableName == Value") or the return value of a function ("myFunc() == Value").
Well: Get AsyncKeyState must be GetAsyncKeyState (without space)
when i tried it your way coder777 it said unexpected ')' before '!' Token
Gaminic could you explain a little further
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
131
132
133
134
135
// Get112420112105.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <cstdlib>
#include <iostream>
#include <windows.h>
#include <conio.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 _tmain(int argc, _TCHAR* 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 i use this program that you sent me "bluecoder" it highlights #include "stdafx.h"
it says that there is no such file directory which header file should i use in the perameters, or what am i doing wrong
Topic archived. No new replies allowed.