Question: I'm working on a C++ assignment in which I have to load a series of files containing data and then search the loaded data for
I'm working on a C++ assignment in which I have to load a series of files containing data and then search the loaded data for specific criteria. The data loaded wll be in binary format. The two files being loaded in are called superheroes.dat and fantasyheroes.dat. The hero has a name, three attributes stored as short variables, Hitpoints / Max-hitpoints variables stored as integers, two armor attributes stored as floats from 0-1 (but represented as a percentage), an inventory containing a variable number of items, each of which contain a name, integer cost, and float for the weight. If a hero doesnt have any items, the file will still have to indicate a 0. Output-wise, you can just print outInventory empty. The hero data looks like this:

Here's main. I need it edited to fit the program:
int main() { cout > option;
/* Load hero files here */
cout
cin >> option; /* Work your magic here */ return 0; }
The output for a hero would look something like this: Name: Gandalf Str: 9 Int: 22 Agi: 16 HP: 65 / 73 Armor: 15% Magic armor: 64% Inventory: Oak staff, 100, 2.17 Gray robes, 26, 2.44 izard hat, 15, 1.5 The output for a hero would look something like this: Name: Gandalf Str: 9 Int: 22 Agi: 16 HP: 65 / 73 Armor: 15% Magic armor: 64% Inventory: Oak staff, 100, 2.17 Gray robes, 26, 2.44 izard hat, 15, 1.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
