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 153 154 155 156
|
//Variables
int money;
int slotnum;
string Playername;
string Side;
string temp;
string DisplayText;
int StartScreenChoice;
int Strength;
int Health;
int Stamina;
int Magic;
string SpecialPower;
int Defence;
int value;
int ClassPick;
int item;
string EquipItem;
string temp2;
string name;
int value2;
string name2;
//Functions
int Pack();
int DOSwindow();
int TheBeginning();
int ChooseClass();
//Classes
/*-------------Equipped Items-------------*/
class ItemEquip
{
public:
int Head()
{
string wantitem;
ifstream inventory("invintory.txt");
cout << "Enter Choice" <<endl;
cin >> name;
while( getline( inventory, temp2 ) )
{
istringstream liness(temp2);
getline(liness,item);
if (name == item)
{
cin >> wantitem;
ifstream inventory("invintory.txt");
while( getline( inventory, temp2 ) )
{
istringstream liness(temp2);
getline(liness, name2, ' ');
if (wantitem == name2)
{
cout << endl;
cout << "Item: " << name2 << endl;
cout << endl;
cout << "Are you sure you want to buy? " << endl;
string respo;
cin >> respo;
if (respo == "yes")
{
ofstream tempfile("temp.txt");
ofstream secondfile("invintory.txt",ios::app);
ifstream secondfile2("invintory.txt");
if (secondfile2.is_open() )
{
vector<string> text_file;
string temp;
string temp2;
while( getline( secondfile2, temp ) )
{
istringstream liness(temp);
getline(liness,item, ' ');
if (name2 == item)
{
tempfile << temp << " done" << endl;
}
if(name2 != item)
{
tempfile << temp << endl;
}
text_file.push_back( temp );
}
inventory.close();
tempfile.close();
secondfile.close();
secondfile2.close();
remove("invintory.txt");
rename("temp.txt","invintory.txt");
ifstream ArmorUp("equipped.txt");
ofstream tempfile2("temp2.txt");
if (ArmorUp.is_open() )
{
vector<string> text_file;
string temp;
string temp2;
string name;
while( getline( ArmorUp, temp ) )
{
istringstream liness(temp);
getline(liness,item);
tempfile2 << temp << endl;
text_file.push_back( temp );
}
tempfile2 << name2 << endl;
tempfile2.close();
ArmorUp.close();
remove("equipped.txt");
rename("temp2.txt","equipped.txt");
}
}
}
if (respo == "no")
{
return 0;
inventory.close();
}
}
}
}
}
}
};
|