hii friends..Am new to this community... am a computer science student... I need your help in creating a small c++ game... Its a project for me... I am told to do it in turbo c++...
okay... the game is so simple... A number memory game... random numbers should be displayed and the user/gameplayer must type in that number very quickly..there must be a time limit for that... the game continues till the user makes a wrong answer... there must of course be a scoring key... As i told you am very new to object oriented concepts... I just started doing small programs using class... I created a small one... it says there are 5 errors- protection errors... pls help me..here is the code..hoping to hear from you all...
#include <stdlib.h>
#include <iostream.h>
#include<conio.h>
class game
public:
int num;
void dispnum();
void getnum();
void result();
};
void game::dispnum()
{
srand((unsigned)time(0));
int random_integer = rand();
cout << random_integer << endl;
}
void game::getnum()
{
cin>>num;
}
void game::result()
if random_integer==num;
cout<<"correct answer";
else
cout<<"wrong answer";
}
void main()
clrscr();
game gam1,gam2,gam3;
gam1.dispnum();
gam2.getnum();
gam3.result();
getch();
}
i dont know how to add time limit or a scoring key..hope u would help me... plsss