Ok so at a specific point in my game, the game just shuts down. I am not sure what the problem is so I am going to throw all the source code up. Any Help is appreciated.

#include <iostream>
#include <windows.h>
#include <fstream>
using namespace std;

string location = "Amasi Village";
string inventory1 = "Empty Slot";
string inventory2 = "Empty Slot";
string inventory3 = "Rmpty Slot";
string inventory4 = "Empty Slot";
string inventory5 = "Empty Slot";
string inventory6 = "Empty Slot";
int gold = 0;
string weapon = "Training Sword";
string helmet = "No Helmet";
string chest = "Bronze Chest Piece";
string legs = "Bronze Leggings";
string gloves = "Leather Gloves";
string boots = "Metal Boots";
string pet = "No Pet";
int abilitypower = 8;
int armor = 45;
int stamina = 55;
int health = 80;
int experience = 0;
int level = 1;
string name;
void NewCharacter();
void LoadCharacter();
void CharacterOptions();
void SaveGame();
void AmasiVillage();
void Koru();
void Reya();
void City();
void CollectQuests();
void ReturnQuests();

int main()
{
	system ("TITLE Might and Power");
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
    cout << "                              Sector 2 Entertainment";
    Sleep(3000);
	system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
    cout << "                                     Presents";
	Sleep(2000);
	system("cls");
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
    cout << "                                 Might and Power";
	Sleep(3000);
	cout << "\n";
	cout << "\n                                 1) New Character";
	cout << "\n                                 2) Load Character";
	cout << "\n                                 3) Exit Game";
	cout << "\n";
	cout << "\n                                 Enter an Option: ";
	int choice;
	cin >> choice;
	if (choice == 1)
    	NewCharacter();
    if (choice == 2)
        LoadCharacter();

               ;

}

void NewCharacter()
{


    system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "                         Hello there,";
	Sleep(1000);
	cout << " may I ask your name?";
	cout << "\n";
	cout << "\n                       Enter Name here: ";
    cin.get();
    getline (cin, name);
    ofstream data ("Character Name.txt");
    data << name;
    data.close();
    ofstream data1 ("Character Level.txt");
    data1 << level;
    data1.close();
    ofstream data2 ("Character Experience.txt");
    data2 << experience;
    data2.close();
    ofstream data3 ("Character Health.txt");
    data3 << health;
    data3.close();
    ofstream data4 ("Character Stamina.txt");
    data4 << stamina;
    data4.close();
    ofstream data5 ("Character Armor.txt");
    data5 << armor;
    data5.close();
    ofstream data6 ("Character Ability Power.txt");
    data6 << abilitypower;
    data6.close();
    ofstream data7 ("Character Pet.txt");
    data7 << pet;
    data7.close();
    ofstream data8 ("Character Helmet.txt");
    data8 << helmet;
    data8.close();
    ofstream data9 ("Character Chest Piece.txt");
    data9 << chest;
    data9.close();
    ofstream data10 ("Character Leggings.txt");
    data10 << legs;
    data10.close();
    ofstream data11 ("Character Gloves.txt");
    data11 << gloves;
    data11.close();
    ofstream data12 ("Character Boots.txt");
    data12 << boots;
    data12.close();
    ofstream data13 ("Character Weapon.txt");
    data13 << weapon;
    data13.close();
    ofstream data14 ("Character Gold.txt");
    data14 << gold;
    data14.close();
    ofstream data15 ("Character Inventory1.txt");
    data15 << inventory1;
    data15.close();
    ofstream data16 ("Character Inventory2.txt");
    data16 << inventory2;
    data16.close();
    ofstream data17 ("Character Inventory3.txt");
    data17 << inventory3;
    data17.close();
    ofstream data18 ("Character Inventory4.txt");
    data18 << inventory4;
    data18.close();
    ofstream data19 ("Character Inventory5.txt");
    data19 << inventory5;
    data19.close();
    ofstream data20 ("Character Inventory6.txt");
    data20 << inventory6;
    data20.close();
    ofstream data21 ("Character Location.txt");
    data21 << location;
    data21.close();







    system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "                         Welcome to Amasi Village ";
    ifstream file("Character Name.txt");
    getline(file, name);
    cout << name;
	Sleep(3000);
	system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "         This village is a safe point between the two lands of Koru and Reya";
	Sleep(3500);
	system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "                    You can travel to Koru and Reya from here\n                        or simply get a ride to the City";
    Sleep(6000);
	system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "               This is also where you can aquire and return quests";
	Sleep(4000);
	AmasiVillage();

}
void LoadCharacter()
{
    ifstream data("Character Name.txt");
    getline(data, name);
    data.close();
    ifstream data1 ("Character Level.txt");
    data1 >> level;
    data1.close();
    ifstream data2 ("Character Experience.txt");
    data2 >> experience;
    data2.close();
    ifstream data3 ("Character Health.txt");
    data3 >> health;
    data3.close();
    ifstream data4 ("Character Stamina.txt");
    data4 >> stamina;
    data4.close();
    ifstream data5 ("Character Armor.txt");
    data5 >> armor;
    data5.close();
    ifstream data6 ("Character Ability Power.txt");
    data6 >> abilitypower;
    data6.close();
    ifstream data7 ("Character Pet.txt");
    data7 >> pet;
    data7.close();
    ifstream data8 ("Character Helmet.txt");
    data8 >> helmet;
    data8.close();
    ifstream data9 ("Character Chest Piece.txt");
    data9 >> chest;
    data9.close();
    ifstream data10 ("Character Leggings.txt");
    data10 >> legs;
    data10.close();
    ifstream data11 ("Character Gloves.txt");
    data11 >> gloves;
    data11.close();
    ifstream data12 ("Character Boots.txt");
    data12 >> boots;
    data12.close();
    ifstream data13 ("Character Weapon.txt");
    data13 >> weapon;
    data13.close();
    ifstream data14 ("Character Gold.txt");
    data14 >> gold;
    data14.close();
    ifstream data15 ("Character Inventory1.txt");
    data15 >> inventory1;
    data15.close();
    ifstream data16 ("Character Inventory2.txt");
    data16 >> inventory2;
    data16.close();
    ifstream data17 ("Character Inventory3.txt");
    data17 >> inventory3;
    data17.close();
    ifstream data18 ("Character Inventory4.txt");
    data18 >> inventory4;
    data18.close();
    ifstream data19 ("Character Inventory5.txt");
    data19 >> inventory5;
    data19.close();
    ifstream data20 ("Character Inventory6.txt");
    data20 >> inventory6;
    data20.close();
    ifstream data21 ("Character Location.txt");
    data21 >> location;
    data21.close();
system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                             Welcome back ";
        cout << name;
        Sleep(2000);
        if (location == "Amasi Village")                RIGHT HERE IS WHERE IT SHUTS OFF!
            AmasiVillage();
        if (location == "Reya")
            Reya();

}
void AmasiVillage()
{
        location = "Amasi Village";
        system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                                 Amasi Village\n";
        cout << "\n";
        cout << "                               1)Collect Quests\n";
        cout << "                               2)Return Quests\n";
        cout << "                               3)Walk to Koru\n";
        cout << "                               4)Walk to Reya\n";
        cout << "                               5)Maktor Ride to the City\n";
        cout << "                               6)Character Options\n";
        cout << "                               7)Save Game\n";
        cout << "                               8)Exit Game\n";
        cout << "\n";
        cout << "                               Enter an Option: ";
        int choice;
        cin >> choice;
        if (choice == 6)
            CharacterOptions();
        if (choice == 7)
            SaveGame();
            AmasiVillage();
        if (choice == 4)
            Reya();


}

void Reya()
{
      location = "Reya";
      system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                                        Reya\n";
        cout << "\n";

        cout << "                               1)Walk to Amasi Village\n";
        cout << "                               2)Battle\n";
        cout << "                               3)Quest Options\n";
        cout << "                               4)Character Options\n";
        cout << "                               5)Save Game\n";
        cout << "                               6)Exit Game\n";
        cout << "\n";
        cout << "                               Enter an Option: ";
        int choice;
        cin >> choice;
        if (choice == 5)
            SaveGame();
            Reya();
}


void SaveGame()
{
    ofstream data ("Character Name.txt");
    data << name;
    data.close();
    ofstream data1 ("Character Level.txt");
    data1 << level;
    data1.close();
    ofstream data2 ("Character Experience.txt");
    data2 << experience;
    data2.close();
    ofstream data3 ("Character Health.txt");
    data3 << health;
    data3.close();
    ofstream data4 ("Character Stamina.txt");
    data4 << stamina;
    data4.close();
    ofstream data5 ("Character Armor.txt");
    data5 << armor;
    data5.close();
    ofstream data6 ("Character Ability Power.txt");
    data6 << abilitypower;
    data6.close();
    ofstream data7 ("Character Pet.txt");
    data7 << pet;
    data7.close();
    ofstream data8 ("Character Helmet.txt");
    data8 << helmet;
    data8.close();
    ofstream data9 ("Character Chest Piece.txt");
    data9 << chest;
    data9.close();
    ofstream data10 ("Character Leggings.txt");
    data10 << legs;
    data10.close();
    ofstream data11 ("Character Gloves.txt");
    data11 << gloves;
    data11.close();
    ofstream data12 ("Character Boots.txt");
    data12 << boots;
    data12.close();
    ofstream data13 ("Character Weapon.txt");
    data13 << weapon;
    data13.close();
    ofstream data14 ("Character Gold.txt");
    data14 << gold;
    data14.close();
    ofstream data15 ("Character Inventory1.txt");
    data15 << inventory1;
    data15.close();
    ofstream data16 ("Character Inventory2.txt");
    data16 << inventory2;
    data16.close();
    ofstream data17 ("Character Inventory3.txt");
    data17 << inventory3;
    data17.close();
    ofstream data18 ("Character Inventory4.txt");
    data18 << inventory4;
    data18.close();
    ofstream data19 ("Character Inventory5.txt");
    data19 << inventory5;
    data19.close();
    ofstream data20 ("Character Inventory6.txt");
    data20 << inventory6;
    data20.close();
    cout << "\n";
    cout << "\n";
    cout << "                                 Save Complete";
    Sleep(1500);


}

Probably because there are a lot of compile errors. Add #include <string> What compiler are you using. I used VC++ 2008 Express and it identified a bunch of errors.

AmasiVillage: contains a recursive function call which will cause a runtime stack overflow. Maybe you meant to do this:

if (choice == 7)
        {
            SaveGame();
            AmasiVillage();
        }

Same problem in function Reya()

Function CharacterOptions() was never coded.

Is this possible to do, like an if statement for a string equaling something because thats where my problem is. The location is a string variable declared earlier, there is no errors its just that the program shuts off at this part of the code. I am using codeblocks as my IDE and the GCC compiler with it.

if (location == "Amasi Village")                
            AmasiVillage();
if (location == "Reya")
            Reya();

Is this possible to do

if (location == "Amasi Village")                
            AmasiVillage();
if (location == "Reya")
            Reya();

Yes it is, if you included <string> and it's a std::string.
Did you change the thing that Ancient Dragon told you? If yes: please post you new code

ok I included <string> but how do i no if its an std string that will work with that, could u give me some sample code or something please.

here is a part of my code this has #include <string> in it.

void LoadCharacter()
{
    ifstream data("Character Name.txt");
    getline(data, name);
    data.close();
    ifstream data1 ("Character Level.txt");
    data1 >> level;
    data1.close();
    ifstream data2 ("Character Experience.txt");
    data2 >> experience;
    data2.close();
    ifstream data3 ("Character Health.txt");
    data3 >> health;
    data3.close();
    ifstream data4 ("Character Stamina.txt");
    data4 >> stamina;
    data4.close();
    ifstream data5 ("Character Armor.txt");
    data5 >> armor;
    data5.close();
    ifstream data6 ("Character Ability Power.txt");
    data6 >> abilitypower;
    data6.close();
    ifstream data7 ("Character Pet.txt");
    data7 >> pet;
    data7.close();
    ifstream data8 ("Character Helmet.txt");
    data8 >> helmet;
    data8.close();
    ifstream data9 ("Character Chest Piece.txt");
    data9 >> chest;
    data9.close();
    ifstream data10 ("Character Leggings.txt");
    data10 >> legs;
    data10.close();
    ifstream data11 ("Character Gloves.txt");
    data11 >> gloves;
    data11.close();
    ifstream data12 ("Character Boots.txt");
    data12 >> boots;
    data12.close();
    ifstream data13 ("Character Weapon.txt");
    data13 >> weapon;
    data13.close();
    ifstream data14 ("Character Gold.txt");
    data14 >> gold;
    data14.close();
    ifstream data15 ("Character Inventory1.txt");
    data15 >> inventory1;
    data15.close();
    ifstream data16 ("Character Inventory2.txt");
    data16 >> inventory2;
    data16.close();
    ifstream data17 ("Character Inventory3.txt");
    data17 >> inventory3;
    data17.close();
    ifstream data18 ("Character Inventory4.txt");
    data18 >> inventory4;
    data18.close();
    ifstream data19 ("Character Inventory5.txt");
    data19 >> inventory5;
    data19.close();
    ifstream data20 ("Character Inventory6.txt");
    data20 >> inventory6;
    data20.close();
    ifstream data21 ("Character Location.txt");
    data21 >> location;
    data21.close();
system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                             Welcome back ";
        cout << name;
        Sleep(2000);
        if (location == "Amasi Village")
            AmasiVillage();
        if (location == "Reya")
            Reya();
}
void AmasiVillage()
{
        location = "Amasi Village";
        system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                                 Amasi Village\n";
        cout << "\n";
        cout << "                               1)Collect Quests\n";
        cout << "                               2)Return Quests\n";
        cout << "                               3)Walk to Koru\n";
        cout << "                               4)Walk to Reya\n";
        cout << "                               5)Maktor Ride to the City\n";
        cout << "                               6)Character Options\n";
        cout << "                               7)Save Game\n";
        cout << "                               8)Exit Game\n";
        cout << "\n";
        cout << "                               Enter an Option: ";
        int choice;
        cin >> choice;
        if (choice == 7)
            SaveGame();
            AmasiVillage();
        if (choice == 4)
            Reya();


}

void Reya()
{
        location = "Reya";
        system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                                        Reya\n";
        cout << "\n";

        cout << "                               1)Walk to Amasi Village\n";
        cout << "                               2)Battle\n";
        cout << "                               3)Quest Options\n";
        cout << "                               4)Character Options\n";
        cout << "                               5)Save Game\n";
        cout << "                               6)Exit Game\n";
        cout << "\n";
        cout << "                               Enter an Option: ";
        int choice;
        cin >> choice;
        if (choice == 5)
            SaveGame();
            Reya();
}

the code is updated i just need my question answered, anyone?

the code is updated i just need my question answered, anyone?

Assuming that "the game just shuts down" still is the question, it is best if you post the updated code, so it can be given a test ride.

Ok here is the updated code, it is still doing the same thing please look at the load game function because it breaks there. It compiles fine its just when it runs. Any help is appreciated. Code Blocks is the IDE I am using btw and the GCC Compiler.

#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>
using namespace std;



string location = "Amasi Village";
string inventory1 = "Empty Slot";
string inventory2 = "Empty Slot";
string inventory3 = "Rmpty Slot";
string inventory4 = "Empty Slot";
string inventory5 = "Empty Slot";
string inventory6 = "Empty Slot";
int gold = 0;
string weapon = "Training Sword";
string helmet = "No Helmet";
string chest = "Bronze Chest Piece";
string legs = "Bronze Leggings";
string gloves = "Leather Gloves";
string boots = "Metal Boots";
string pet = "No Pet";
int abilitypower = 8;
int armor = 45;
int stamina = 55;
int health = 80;
int experience = 0;
int level = 1;
string name;
void NewCharacter();
void LoadCharacter();
void CharacterOptions();
void SaveGame();
void AmasiVillage();
void Koru();
void Reya();
void City();
void CollectQuests();
void ReturnQuests();

int main()
{
	system ("TITLE Might and Power");
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
    cout << "                              Sector 2 Entertainment";
    Sleep(3000);
	system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
    cout << "                                     Presents";
	Sleep(2000);
	system("cls");
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
    cout << "                                 Might and Power";
	Sleep(3000);
	cout << "\n";
	cout << "\n                                 1) New Character";
	cout << "\n                                 2) Load Character";
	cout << "\n                                 3) Exit Game";
	cout << "\n";
	cout << "\n                                 Enter an Option: ";
	int choice;
	cin >> choice;
	if (choice == 1)
    	NewCharacter();
    if (choice == 2)
        LoadCharacter();

               ;

}

void NewCharacter()
{


    system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "                         Hello there,";
	Sleep(1000);
	cout << " may I ask your name?";
	cout << "\n";
	cout << "\n                       Enter Name here: ";
    cin.get();
    getline (cin, name);
    ofstream data ("Character Name.txt");
    data << name;
    data.close();
    ofstream data1 ("Character Level.txt");
    data1 << level;
    data1.close();
    ofstream data2 ("Character Experience.txt");
    data2 << experience;
    data2.close();
    ofstream data3 ("Character Health.txt");
    data3 << health;
    data3.close();
    ofstream data4 ("Character Stamina.txt");
    data4 << stamina;
    data4.close();
    ofstream data5 ("Character Armor.txt");
    data5 << armor;
    data5.close();
    ofstream data6 ("Character Ability Power.txt");
    data6 << abilitypower;
    data6.close();
    ofstream data7 ("Character Pet.txt");
    data7 << pet;
    data7.close();
    ofstream data8 ("Character Helmet.txt");
    data8 << helmet;
    data8.close();
    ofstream data9 ("Character Chest Piece.txt");
    data9 << chest;
    data9.close();
    ofstream data10 ("Character Leggings.txt");
    data10 << legs;
    data10.close();
    ofstream data11 ("Character Gloves.txt");
    data11 << gloves;
    data11.close();
    ofstream data12 ("Character Boots.txt");
    data12 << boots;
    data12.close();
    ofstream data13 ("Character Weapon.txt");
    data13 << weapon;
    data13.close();
    ofstream data14 ("Character Gold.txt");
    data14 << gold;
    data14.close();
    ofstream data15 ("Character Inventory1.txt");
    data15 << inventory1;
    data15.close();
    ofstream data16 ("Character Inventory2.txt");
    data16 << inventory2;
    data16.close();
    ofstream data17 ("Character Inventory3.txt");
    data17 << inventory3;
    data17.close();
    ofstream data18 ("Character Inventory4.txt");
    data18 << inventory4;
    data18.close();
    ofstream data19 ("Character Inventory5.txt");
    data19 << inventory5;
    data19.close();
    ofstream data20 ("Character Inventory6.txt");
    data20 << inventory6;
    data20.close();
    ofstream data21 ("Character Location.txt");
    data21 << location;
    data21.close();







    system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "                         Welcome to Amasi Village ";
    ifstream file("Character Name.txt");
    getline(file, name);
    cout << name;
	Sleep(3000);
	system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "         This village is a safe point between the two lands of Koru and Reya";
	Sleep(3500);
	system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "                    You can travel to Koru and Reya from here\n                        or simply get a ride to the City";
    Sleep(6000);
	system("cls");
    cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "               This is also where you can aquire and return quests";
	Sleep(4000);
	AmasiVillage();

}
void LoadCharacter()
{
    ifstream data("Character Name.txt");
    getline(data, name);
    data.close();
    ifstream data1 ("Character Level.txt");
    data1 >> level;
    data1.close();
    ifstream data2 ("Character Experience.txt");
    data2 >> experience;
    data2.close();
    ifstream data3 ("Character Health.txt");
    data3 >> health;
    data3.close();
    ifstream data4 ("Character Stamina.txt");
    data4 >> stamina;
    data4.close();
    ifstream data5 ("Character Armor.txt");
    data5 >> armor;
    data5.close();
    ifstream data6 ("Character Ability Power.txt");
    data6 >> abilitypower;
    data6.close();
    ifstream data7 ("Character Pet.txt");
    data7 >> pet;
    data7.close();
    ifstream data8 ("Character Helmet.txt");
    data8 >> helmet;
    data8.close();
    ifstream data9 ("Character Chest Piece.txt");
    data9 >> chest;
    data9.close();
    ifstream data10 ("Character Leggings.txt");
    data10 >> legs;
    data10.close();
    ifstream data11 ("Character Gloves.txt");
    data11 >> gloves;
    data11.close();
    ifstream data12 ("Character Boots.txt");
    data12 >> boots;
    data12.close();
    ifstream data13 ("Character Weapon.txt");
    data13 >> weapon;
    data13.close();
    ifstream data14 ("Character Gold.txt");
    data14 >> gold;
    data14.close();
    ifstream data15 ("Character Inventory1.txt");
    data15 >> inventory1;
    data15.close();
    ifstream data16 ("Character Inventory2.txt");
    data16 >> inventory2;
    data16.close();
    ifstream data17 ("Character Inventory3.txt");
    data17 >> inventory3;
    data17.close();
    ifstream data18 ("Character Inventory4.txt");
    data18 >> inventory4;
    data18.close();
    ifstream data19 ("Character Inventory5.txt");
    data19 >> inventory5;
    data19.close();
    ifstream data20 ("Character Inventory6.txt");
    data20 >> inventory6;
    data20.close();
    ifstream data21 ("Character Location.txt");
    data21 >> location;
    data21.close();
system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                             Welcome back ";
        cout << name;
        Sleep(2000);
        if (location == "Amasi Village")

            AmasiVillage();

        if (location == "Reya")

            Reya();


}
void AmasiVillage()
{
        location = "Amasi Village";
        system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                                 Amasi Village\n";
        cout << "\n";
        cout << "                               1)Collect Quests\n";
        cout << "                               2)Return Quests\n";
        cout << "                               3)Walk to Koru\n";
        cout << "                               4)Walk to Reya\n";
        cout << "                               5)Maktor Ride to the City\n";
        cout << "                               6)Character Options\n";
        cout << "                               7)Save Game\n";
        cout << "                               8)Exit Game\n";
        cout << "\n";
        cout << "                               Enter an Option: ";
        int choice;
        cin >> choice;
        if (choice == 7)
            SaveGame();
            AmasiVillage();
        if (choice == 4)
            Reya();


}

void Reya()
{
        location = "Reya";
        system("cls");
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "\n";
        cout << "                                        Reya\n";
        cout << "\n";

        cout << "                               1)Walk to Amasi Village\n";
        cout << "                               2)Battle\n";
        cout << "                               3)Quest Options\n";
        cout << "                               4)Character Options\n";
        cout << "                               5)Save Game\n";
        cout << "                               6)Exit Game\n";
        cout << "\n";
        cout << "                               Enter an Option: ";
        int choice;
        cin >> choice;
        if (choice == 5)
            SaveGame();
            Reya();
}


void SaveGame()
{
    ofstream data ("Character Name.txt");
    data << name;
    data.close();
    ofstream data1 ("Character Level.txt");
    data1 << level;
    data1.close();
    ofstream data2 ("Character Experience.txt");
    data2 << experience;
    data2.close();
    ofstream data3 ("Character Health.txt");
    data3 << health;
    data3.close();
    ofstream data4 ("Character Stamina.txt");
    data4 << stamina;
    data4.close();
    ofstream data5 ("Character Armor.txt");
    data5 << armor;
    data5.close();
    ofstream data6 ("Character Ability Power.txt");
    data6 << abilitypower;
    data6.close();
    ofstream data7 ("Character Pet.txt");
    data7 << pet;
    data7.close();
    ofstream data8 ("Character Helmet.txt");
    data8 << helmet;
    data8.close();
    ofstream data9 ("Character Chest Piece.txt");
    data9 << chest;
    data9.close();
    ofstream data10 ("Character Leggings.txt");
    data10 << legs;
    data10.close();
    ofstream data11 ("Character Gloves.txt");
    data11 << gloves;
    data11.close();
    ofstream data12 ("Character Boots.txt");
    data12 << boots;
    data12.close();
    ofstream data13 ("Character Weapon.txt");
    data13 << weapon;
    data13.close();
    ofstream data14 ("Character Gold.txt");
    data14 << gold;
    data14.close();
    ofstream data15 ("Character Inventory1.txt");
    data15 << inventory1;
    data15.close();
    ofstream data16 ("Character Inventory2.txt");
    data16 << inventory2;
    data16.close();
    ofstream data17 ("Character Inventory3.txt");
    data17 << inventory3;
    data17.close();
    ofstream data18 ("Character Inventory4.txt");
    data18 << inventory4;
    data18.close();
    ofstream data19 ("Character Inventory5.txt");
    data19 << inventory5;
    data19.close();
    ofstream data20 ("Character Inventory6.txt");
    data20 << inventory6;
    data20.close();
    cout << "\n";
    cout << "\n";
    cout << "                                 Save Complete";
    Sleep(1500);


}

The code you posted appears to be a rather poor way of designing the file system for saving and restoring character information for your game. Why not just store everything in one file so that the data can be read back using only one file stream ? That entire function could be writtin in just three or four lines of code

void LoadCharacter()
{
    ifstream data("Character Name.txt");
    getline(data, name);
    data >> level >> experience >> health >> stamina >>
        armor >> abilitypower >> // etc. etc. for all other items
}

but how would it work so that only specific data is written to a specific variable, such as this. I need to write the First line to name then 2nd line to level and 3rd line to experience and so on. That is why I did it that way.

Regarding code readability, you could save a lot vertical space by changing

cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";

to

cout << "\n\n\n\n\n\n\n\n\n";

but how would it work so that only specific data is written to a specific variable, such as this. I need to write the First line to name then 2nd line to level and 3rd line to experience and so on. That is why I did it that way.

There are a couple ways. One way is just exactly like I posted before -- data is read in exactly the same order that it was written.

void SaveCharacter()
{
    ofstream data("Character Name.txt");
    data << name << "\n";
    data << level << " " << experience << " " << health << " " << stamina << " " <<
        armor << " " <<abilitypower << " " <<// etc. etc. for all other items
}

Another way is using tagged lines. Its more flexible because you can easily add more items to the file without changing the code very much -- but its more difficult to code.

name="cam9856"
level=25
experience=654321
armor=1
// etc

Regarding code readability, you could save a lot vertical space by changing

cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";
	cout << "\n";

to

cout << "\n\n\n\n\n\n\n\n\n";

Or use a string object so that the number of characters is more obvious:

cout << string(9, '\n');

If you use that a lot, you can also make a parameterized manipulator so it's even more obvious what the intention of the code is:

#include <iostream>
#include <string>

class pad {
  int _count;
  char _padding;
public:
  pad(int count, char padding)
    : _count(count), _padding(padding)
  {}

  friend std::ostream& operator<<(std::ostream& os, const pad& manip) {
    return os << std::string(manip._count, manip._padding);
  }
};

int main()
{
  std::cout << '|' << pad(12, '\n') << "|\n";
}
This article has been dead for over six months. Start a new discussion instead.