Auto close

Hi i've been having some problems as as soon as i open this program it automatically closes straight after you get one wrong i was wondering if there was a way to make them press a button before it closes.
here is the source code.


// dragons.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
int Choice;

printf( "Welcome to Shaun Ripper's Epic Adventure Saga.\n" );
printf( "You will be placed in the life of shador the great. ENJOY!\n" );
printf( "The Story so Far........\n" );
printf( "It is the dark ages, the knight saga when dragons and magicians still lived.\n" );
printf( "As there was once a protector named Shador the dragon knight who lived in " );
printf( "in the castle of Olon.\n" );
printf( "Shador saved Olon from many arising threats until the day Havenger rose.\n" );
printf( "He used magic to stun shador by surprise in the air. Shador fell out of " );
printf( "sky and was never seen again. Havenger was immediately exicuted for his " );
printf( "crimes leaving Olon to grave danger." );
printf( " But Havenger arose from the nether world with an army of dragons.\n" );
printf( "Luckily the savior of Olon wasn't dead although " );
printf( "Shador has lost his past memories as a dragon knight and other memories.\n" );
printf( "Will he recoop in time to save Olon!" );

printf( "\n\nYou wake in a mysterious dungeon.\n" );
printf( "Deep wounds are apparent on your body.\n" );
printf( "You stand up it's long and dark and a light at the end.\n" );
printf( "You start to hobble out to the light, a vast world awates you.\n" );

printf( "\ninput 1 to survey your surroundings at the light.\n" );
printf( "input 2 to jump when reached light.\n" );
printf( "\n" );

printf( "Choose wisely.\n" );
scanf( "%d", &Choice );

if( Choice == 1 )
{
printf( "North, a castle in flames with a dragon above.\n" );
printf( "East, utterly dense forest.\n" );
printf( "West, utterly dense forest.\n" );
printf( "South, the dark dungeon you came from.\n" );
printf( "But below is a large cliff that you could easily fall of on.\n" );
}
else if( Choice == 2 )
{
printf( "Whilst jumping you dont land and fall to your death.\n" );
return(0);
}
else
{
printf( "You stand pondering your for to long and get swooped by a dragon.\n" );
return(0);
}

printf( "You see an easily scaleable side, but how will get you there!\n" );

printf( "\ninput 1 if you want to jump for the destination.\n" );
printf( "input 2 if you want to scale the cliff side.\n" );

printf( "Choose wisely.\n" );
scanf( "%d", &Choice );

if( Choice == 1 )
{
printf( "You take a short run up and leap luckily you just make the distance.\n" );
}
else if( Choice == 2 )
{
printf( "You slowly edge your way on a thin rock surface and slip to a falling death.\n" );
return(0);
}
else
{
printf( "You stand hesitating and then the ground before you crumbles.\n" );
return(0);
}

printf( "You uneasily scale down the rocky slope and at the bottom you reach 3 pathways.\n" );
printf( "Path 1.Forest, Path 2.Castle, Path 3.Forest" );

printf( "\n\ninput 1 to follow path 1.\n" );
printf( "input 2 to follow path 2.\n" );
printf( "input 3 to follow path 3\n" );

printf( "Choose wisely.\n" );
scanf( "%d", &Choice );

if( Choice == 1 )
{
printf( "You leisurely stroll through the forest and once deep loosing the pathway.\n" );
printf( "Your lost, scared, hungry you eventually die by a vigerous pack of wolves.\n" );
return(0);
}
else if( Choice == 2 )
{
printf( "You walk in the shadows trying to avoid the dragon.\n" );
printf( "When suddenly you are grabbed and pulled into secret village.\n" );
}
else if( Choice == 3 )
{
printf( "You leisurely stroll through the forest and once deep loosing the pathway.\n" );
printf( "Your lost, scared, hungry you eventually die by a vigerous pack of wolves.\n" );
return(0);
}
else
{
printf( "Trying to organise your thoughts the dragon you spotted earlier\n" );
printf( "spots you burns you to death.\n" );
return(0);
}

printf( "To your surprise this was a doctor who is trying to protect you from the dragon.\n" );
printf( "He examines your wounds and takes you to his hut for healing, unvieling a tatoo.\n" );
printf( "The doctor recognised this straight away and informed the town gypsy.\n" );
printf( "You are deeply puzzeled but decide to play along.\n" );
printf( "Entering the gypsy tent she gives you a look of mystery and says.\n" );
printf( "'Get out of my sight you grotty man.'\n" );

printf( "\ninput 1 to hit the gypsy for offending you.\n" );
printf( "input 2 to sit down plead to the gypsy for help.\n" );
printf( "Choose wisely.\n" );

scanf( "%d", &Choice );

if( Choice == 1 )
{
printf( "After hitting her you immediately regret it as guards storm through the tent.\n" );
printf( "and impale you with their swords as you are thought to be an intruder.\n" );
return(0);
}
else if( Choice == 2 )
{
printf( "You immediatly show The gypsy your tatoo and she turns gobsmacked.\n" );
printf( "She utters out 'Th, th the savior is back THE DRAGON KNIGHT HAS RETURNED.\n" );
}
else
{
printf( "You stand there like a dummy in your own world ignoring the gypsy totally.\n" );
printf( "She calls the guards. The guards come and throw you out in the dragons " );
printf( "firing zone you are immediately incinerated.\n" );
return(0);
}

printf( "\nYou sit and listen you tell the gypsy you have to memories at all.\n" );
printf( "She tells you everything. She starts, 'Your name is Shador you were once the " );
printf( "great savior of this land and protector. Until the day you were banished from " );
printf( "Olon castle then Havenger rose from the nether and leads the dragon army.\n" );
printf( "Your our only hope Shador.'\n" );
return 0;
}

If you are using Dev C++ then you need to have this before your return statement:
system("pause");

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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// dragons.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
int Choice;

printf( "Welcome to Shaun Ripper's Epic Adventure Saga.\n" );
printf( "You will be placed in the life of shador the great. ENJOY!\n" );
printf( "The Story so Far........\n" );
printf( "It is the dark ages, the knight saga when dragons and magicians still lived.\n" );
printf( "As there was once a protector named Shador the dragon knight who lived in " );
printf( "in the castle of Olon.\n" );
printf( "Shador saved Olon from many arising threats until the day Havenger rose.\n" );
printf( "He used magic to stun shador by surprise in the air. Shador fell out of " );
printf( "sky and was never seen again. Havenger was immediately exicuted for his " );
printf( "crimes leaving Olon to grave danger." );
printf( " But Havenger arose from the nether world with an army of dragons.\n" );
printf( "Luckily the savior of Olon wasn't dead although " );
printf( "Shador has lost his past memories as a dragon knight and other memories.\n" );
printf( "Will he recoop in time to save Olon!" );

printf( "\n\nYou wake in a mysterious dungeon.\n" );
printf( "Deep wounds are apparent on your body.\n" );
printf( "You stand up it's long and dark and a light at the end.\n" );
printf( "You start to hobble out to the light, a vast world awates you.\n" );

printf( "\ninput 1 to survey your surroundings at the light.\n" );
printf( "input 2 to jump when reached light.\n" );
printf( "\n" );

printf( "Choose wisely.\n" );
scanf( "%d", &Choice );

if( Choice == 1 )
{
printf( "North, a castle in flames with a dragon above.\n" );
printf( "East, utterly dense forest.\n" );
printf( "West, utterly dense forest.\n" );
printf( "South, the dark dungeon you came from.\n" );
printf( "But below is a large cliff that you could easily fall of on.\n" );
}
else if( Choice == 2 )
{
printf( "Whilst jumping you dont land and fall to your death.\n" );
return(0);
}
else
{
printf( "You stand pondering your for to long and get swooped by a dragon.\n" );
return(0);
}

printf( "You see an easily scaleable side, but how will get you there!\n" );

printf( "\ninput 1 if you want to jump for the destination.\n" );
printf( "input 2 if you want to scale the cliff side.\n" );

printf( "Choose wisely.\n" );
scanf( "%d", &Choice );

if( Choice == 1 )
{
printf( "You take a short run up and leap luckily you just make the distance.\n" );
}
else if( Choice == 2 )
{
printf( "You slowly edge your way on a thin rock surface and slip to a falling death.\n" );
return(0);
}
else
{
printf( "You stand hesitating and then the ground before you crumbles.\n" );
return(0);
}

printf( "You uneasily scale down the rocky slope and at the bottom you reach 3 pathways.\n" );
printf( "Path 1.Forest, Path 2.Castle, Path 3.Forest" );

printf( "\n\ninput 1 to follow path 1.\n" );
printf( "input 2 to follow path 2.\n" );
printf( "input 3 to follow path 3\n" );

printf( "Choose wisely.\n" );
scanf( "%d", &Choice );

if( Choice == 1 )
{
printf( "You leisurely stroll through the forest and once deep loosing the pathway.\n" );
printf( "Your lost, scared, hungry you eventually die by a vigerous pack of wolves.\n" );
return(0);
}
else if( Choice == 2 )
{
printf( "You walk in the shadows trying to avoid the dragon.\n" );
printf( "When suddenly you are grabbed and pulled into secret village.\n" );
}
else if( Choice == 3 )
{
printf( "You leisurely stroll through the forest and once deep loosing the pathway.\n" );
printf( "Your lost, scared, hungry you eventually die by a vigerous pack of wolves.\n" );
return(0);
}
else
{
printf( "Trying to organise your thoughts the dragon you spotted earlier\n" );
printf( "spots you burns you to death.\n" );
return(0);
}

printf( "To your surprise this was a doctor who is trying to protect you from the dragon.\n" );
printf( "He examines your wounds and takes you to his hut for healing, unvieling a tatoo.\n" );
printf( "The doctor recognised this straight away and informed the town gypsy.\n" );
printf( "You are deeply puzzeled but decide to play along.\n" );
printf( "Entering the gypsy tent she gives you a look of mystery and says.\n" );
printf( "'Get out of my sight you grotty man.'\n" );

printf( "\ninput 1 to hit the gypsy for offending you.\n" );
printf( "input 2 to sit down plead to the gypsy for help.\n" );
printf( "Choose wisely.\n" );

scanf( "%d", &Choice );

if( Choice == 1 )
{
printf( "After hitting her you immediately regret it as guards storm through the tent.\n" );
printf( "and impale you with their swords as you are thought to be an intruder.\n" );
return(0);
}
else if( Choice == 2 )
{
printf( "You immediatly show The gypsy your tatoo and she turns gobsmacked.\n" );
printf( "She utters out 'Th, th the savior is back THE DRAGON KNIGHT HAS RETURNED.\n" );
}
else
{
printf( "You stand there like a dummy in your own world ignoring the gypsy totally.\n" );
printf( "She calls the guards. The guards come and throw you out in the dragons " );
printf( "firing zone you are immediately incinerated.\n" );
return(0);
}

printf( "\nYou sit and listen you tell the gypsy you have to memories at all.\n" );
printf( "She tells you everything. She starts, 'Your name is Shador you were once the " );
printf( "great savior of this land and protector. Until the day you were banished from " );
printf( "Olon castle then Havenger rose from the nether and leads the dragon army.\n" );
printf( "Your our only hope Shador.'\n" );
return 0;
}
is it case sensitive
and im using visual basics
Last edited on
So is there anything i can do
Topic archived. No new replies allowed.