Bulbasaur|Grass| |2|16|45|65|65|45|0.059
Ivysaur|Grass|Poison|3|32|60|80|80|60|0.059
Venusaur|Grass|Poison| | |80|100|100|80|0.059
Torchic|Fire| |23|16|45|70|50|45|0.045
Combusken|Fire|Fighting|24|36|60|85|60|55|0.045
Blaziken|Fire|Fighting| | |80|110|70|80|0.045
These are some data in my text file, which stores Pokemon's name, type 1, type 2, index number of evolved Pokemon from the list, and stats, with character "|"
as dividing lines, how do I read all hundreds of similar data into a 2D array? Or any other form of array which gives better result?
These are my C++ codes, and the result are totally failure.
ifstream inFile;
inFile.open("PokemonBaseStats.txt");
if (inFile.fail())
{
cerr << "Could not find file" << endl;
}
vector<string> code;
string S;
while (inFile >> S) {
code.push_back(S);
inFile >> name >> type1 >> type2 >> evolveTo >> evolveLevel >> hp >> atk >> def >> spd >> catchRate;
cout << name << type1 << type2 << evolveTo << evolveLevel << hp << atk << def << spd << catchRate;
}
system("PAUSE");
return 0;
The output is:-