Runtime Error Message

I am having a runtime error message whenever the application reaches the function "riggedfight" and i am having no luck figuring out why. Any ideas what the problem is? The function itself is about 3/4 down the page.

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
//current error message: "This application has requested the Runtime to terminate it in an unusual way. please contact the application's support team for more information." 

#include <iostream>
#include <fstream>
using namespace std;

string Rattata ();
string Pidgey ();
string Magikarp ();
string PinkiePie ();
string OAK ();
string begining1 (){
    string name;
    cout << "\nHello there! Welcome to the world of POKEMON! My name is OAK! People call me thePOKEMON PROF! This world is inhabited by creatures called POKEMON! For some people, POKEMON are pets. Others use them for fights. Myself... I study POKEMON as a profession. First, what is your name? ";
    cin >> name;
    cout << "Right, so your name is " << name << " ... ... i woulda picked Quinn myself.";
    return name;
}
string begining2 (string rival_gender){
       string name, rg1, rg2;
       if (rival_gender == " he "){
                        rg1= " him ";
                        rg2= " his ";
       }
       else {
            rg1= " her ";
            rg2= " her ";
       }
       cout << " Hmm... well, the reason i called you over here today is because about 2 weeks ago i sent off a random kid that i mistook as my prodigal student. Don't judge me, I have bad eyes."<< rival_gender <<"was wearing a red baseball cap and a funny white and red shirt... You met" <<rg1<< "?! What was"<<rg2<<"name again? ";
       cin >> name;
       return name;
}
string Pokemon (string r_n){
       string help= "Type the name of the pokemon you chose. Type pokedex_pokemon name (ie. pokedex_rattata) for a pokemons stats.", pokemon="n/a", answer, pokedex_info;
       cout << " Ok, so i gave " << r_n << " one of the three pokemon that i was going to let my pupil have, and i gave my grandson another, and um, kinda lost the third. I have bad eyes! I'm old! \n Anyway, i found a few old pokeballs in my closet last night, and thought to myself 'I really need to clean out my closet from time to time.' Anyway, i want you to pick one of these three pokemon, track down that kid... um... it'd be kinda mean to take the pokemon back. And the pokemon wouldn't really want to come back... So. You know what, just have a pokemon.";
       cout << "\n*type help for help at any time*\n|rattata\n|pidgey\n|magikarp\n" << help << endl;
       while (pokemon =="n/a"){
             cin >> answer;
             if (answer=="help"){
                                 cout << help;
             }
             if (answer=="pokedex_rattata"){
                                            pokedex_info= Rattata ();
                                            cout << pokedex_info;
             }
             if (answer=="pokedex_pidgey"){
                                           pokedex_info= Pidgey ();
                                           cout << pokedex_info;
             }
             if (answer=="pokedex_magikarp"){
                                             pokedex_info= Magikarp ();
                                             cout << pokedex_info;
             }
             if (answer=="pokedex_OAK"){
                                        pokedex_info= OAK ();
                                        cout << pokedex_info;
             }
             if (answer=="pokedex_PinkiePie"){
                                              pokedex_info= PinkiePie ();
                                              cout << pokedex_info;
             }
             if (answer=="OAK"){
                                cout << "Wait! WHAT?!\n";
             }
             if ((answer=="rattata")||(answer=="pidgey")||(answer=="magikarp")||(answer=="PinkiePie")){
                                                                        pokemon=answer;
             }
             else{
                  cout << "\nPlease chose a pokemon. ";
             }
       }
       return pokemon;
}
string Rattata (){
       string info="RATTATA: 1'0\"  8 LBS\n\"WILL CHEW ON ANYTHING WITH ITS FANGS. IF YOU SEE ONE, IT IS CERTAIN THAT 40 MORE LIVE IN THE AREA\"\n|TACKLE\n|TAIL WHIP\n|QUICK ATTACK (LV9)\n|HYPER FANG (LV14)\n|FOCUS ENERGY (LV23)\n|SUPER FANG (LV34)";
       return info;
}
string Pidgey (){
       string info="PIDGEY: 1'0\" 4 LBS\n\"VERY DOCILE. IF ATTACKED, IT WILL OFTEN KICK UP SAND TO PROTECT ITSELF RATHER THAN FIGHT BACK.\"\n|GUST\n|SAND-ATTACK (LV5)\n|QUICK ATTACK (LV12)\n|WHIRLWIND (LV19)\n|WING ATTACK (LV28)\n|AGILITY (LV36)\n|MIRROR MOVE (LV44)";
       return info;
}
string Magikarp (){
       string info="MAGIKARP: 2'11\" 22 LBS\n\"FAMOUS FOR BEING VERY UNRELIABLE. IT CAN BE FOUND SWIMMING IN SEAS, LAKES, RIVERS, AND SHALLOW PUDDLES.\"\n|SPLASH\n|TACKLE (LV15)";
       return info;
}
string PinkiePie (){
       string info="PINKAMINA DIANE PIE: 3'4\" ? LBS \n\"CAUTION: LOVES PARTIES LIKE THERES NO TOMORROW.\"\n|PARTY TIME\n|PUPPY EYES\n|SUGAR OVERLOAD (LV12)";
       return info;
}
string OAK (){
       string info="Some old guy with failing eyesight.";
       return info;
}
string beginning3 (string x){
       string nickname="n/a", answer, help="type y to give your pokemon a name, and n to not name it. Remember, nicknames ARE permanent.";
       cout << " Do you want to give "<<x<<" a nickname?(y/n)";
       while (nickname =="n/a"){
             cin >> answer;
             if (answer=="help"){
                               cout << help;
             }
             if (answer=="y"){
                            cout << "What would you like to name " << x << ":  ";
                            cin >> nickname;
                            cout << nickname <<", huh. Well, ok then.\n";
             }
             if (answer=="n"){
                            nickname=x;
             }
             if (nickname=="n/a"){
                                  cout << "Do you want to give "<<x<<" a nickname? (y/n)";
             }
       }
       return nickname;
}
string riggedfight (){ //string pokemon){ temporarily disabled until runtime error is fixed
       cout << "its working!"; //temporary message until runtime error is fixed
       return 0;
}       
int main (){
    cout << "Before we get started, how about some info. Gender? (male/female): ";
    string main_name, rival_name, gender1="n/a",gender,rival_gender,pokemon1nn, pokemon1;
    while (gender1=="n/a"){
          cin >> gender;
          if (gender=="male"){
                              gender1=" Mr. ";
                              rival_gender=" she ";
          }
          if (gender=="female"){
                                gender1=" Ms. ";
                                rival_gender=" he ";
          }
          if (gender1 == "n/a"){
                      cout << "Um, try that again. male or female: ";
          }
    }
    main_name = begining1 ();
    cout << "\nWelcome " << main_name;
    rival_name = begining2 (rival_gender);
    pokemon1 = Pokemon (rival_name);
    cout << "Hmm... well, i wouldn't have chose "<<pokemon1<<", but if you really want it.";
    pokemon1nn = beginning3 (pokemon1);
    cout << "Well, first things first, you should probably learn to fight with your new pokemon. How about... fighting... ... THAT DESK! No not that one, the one over there with the bowling ball on it.\n";
    cout << "Enemy Desk with Bowling Ball has been sited! Go " << pokemon1nn << "!/n";
    riggedfight ();//pokemon1nn); temporarily disabled until runtime error is fixed
    system("PAUSE"); //temporary system pause
    return 0;
}
1
2
3
4
string riggedfight (){ //string pokemon){ temporarily disabled until runtime error is fixed
       cout << "its working!"; //temporary message until runtime error is fixed
       return 0;
} 

You have to change either the return type or the return statement.

This will work fine -> string riggedfight() { /*...*/ return ""; }

This will work fine too -> int riggedfight() { /*...*/ return 0; }

This will also work fine -> void riggedfight() { /*...*/ return; }
Awesome! It worked, thanks!
Topic archived. No new replies allowed.