guys first sorry for sparing your time with me.I need to learn from you how to use structure cause i allways try and nothing.Errors and errors.I will post my try.5 errors.Ty
#include<iostream.h>
#include<conio.h>
class Game
{
private:
int x,y;
char ch;
public:
void initializare()
{
x=0;
y=0;
}
void miscare()
{
while(ch!='\r')
{
ch = getche();
switch (ch)
{
case 'w':x++;
break;
case 's':x--;
break;
case 'a':y--;
break;
case 'd':y++;
break;
default:cout<<"wrong choice(w/s/a/d)";
}
cout<<"You are at "<<x<<" And "<<y<<endl;
}
}
}
int main()
{
Game f1;
f1.initializare();
f1.miscare();
}
and now the error log:
prog.cpp:36: error: new types may not be defined in a return type
prog.cpp:36: note: (perhaps a semicolon is missing after the definition of `Game')
prog.cpp:36: error: extraneous `int' ignored
prog.cpp:36: error: `main' must return `int'
prog.cpp:36: error: return type for `main' changed to `int'
prog.cpp:41:2: warning: no newline at end of file