riddle game

im trying to make a riddle game where your correct answers get you to the next level, but having a hard time coming up with what way to go about it any ideas would be appreciated and maybe a little sample code thanks in advance.

Just use an int for points or something and then an if statement for the levels.
1
2
3
4
5
6
7
8
9
// Questions
if (input == correct_answer)
{ points = points + 10}
if (points > 50)
{ // user moves on to lvl 2 
}
else
{ // ask more questions
}
I will look to that
Maybe you've already done it, but it might be a better idea, depending on how long the game is, to just run a function that determines the level after asking each question.
any other ideas
just run a function that determines the level after asking each question.[url=http://www.rctophobby.com/rc-helicopters/shop-by-brand/esky.html]esky rc helicopter[/url]
Last edited on
I would go about having a couple of functions names of functions will be what they do in my example. A bool value that will determine if person is right. Lastly an int value for level. Also an int for difficulty.
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
int difficulty=1;
int lvl =1;
bool correct;
//use a srand() to randomly pick questions of a list. preferably with time and % how many questions you have.

void Riddle()
{
  switch(srand())//used to pull up question

   case 1:.....
    cin>>answer;
    //test your bool 
if true
lvl++
   }
void difficulty(int lvl)
{
if (lvl/difficulty==(whatever level you want before you raise difficulty))//this must be at an interval though so like every 5 lvl is + 1to difficulty
difficulty++;}

(type) question difficulty() //can make a function for setting an array of questions = to a difficutly
{
if difficulty ==1
return arEasy

etc etc
}
   


Im still knew to programming so my way might not be efficient but here is a quick idea of how I would go about writing a riddle program.
Topic archived. No new replies allowed.