Text Adventure

I am working on a text adventure right now, and it's pretty good if I do say so myself. But right now there is one big issue that continues to vex me. Help would be appreciated!

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
a = 0;
	b = 5;

	while (a > 5)
	{
  if (answer5 == "2")                                                              //this is if answer is 2
  { cout << "You die from being really fat and your fat suffocates you."<<endl; 
    Sleep (4 * 1000);
		a = 1;
		b = 500;
		while (a < b)
	{ cout << "-  -    -      - -  -    -  - -   -     -       -   -    -   - -    -  -";
		a = a + 1; } 
		system("CLS");
		cout << "YOU DIED";
		Sleep (4 * 1000);
		system("CLS");
		cout << "Would you like to restart?"<<endl;
		cin >> answer1;

		if ( answer1 == "yes" || answer1 == "Yes")
		{ goto  Beginning; }
		
		else if (answer1 == "no" || answer1 == "No")
			{ return 0; }
  }


  else if (answer5 != "1" || answer5 != "2")
			{ cout << "Did you read the instructions? Either you didn't read the instructions or your just plain stupid."<<endl;  //security protocol if someone doesnt answer yes or no
		Sleep (4* 1000);                                                                                                          //need to add it throughout program
		return 0; }
	


  else if (answer5 == "1")  //this is if answer is 1 (CORRECT)
  {   system("CLS");
	  goto yes1; }        
    
	

  Sleep(2 * 1000);
  a = a + 1;
  if (a >= 5)
  {goto timerunout;}
	}


The problem is that I don't know how to make the program go to the time run out.
I assume (but might be wrong) that the program would go through this whole portion until until either 'option 1' or 'option 2' was entered or 'a' became equal to 5.

This isn't my whole text adventure, just the part that gives me trouble. So
all the 'gotos' and answer5 are taken care of outside of this portion of the program. Thanks for any help.
Last edited on
A few things:
- Don't use gotos
- Frankly, learn to indent (your current style is completely inconsistent and hard to read)
- What is the trouble you are having with this part?
I'm trying to make it so that after 10 seconds it'll go to the timerunout which isn't shown in this portion of the program. I don't know a better way than gotos.
Topic archived. No new replies allowed.