ok i having a little trouble adding a string to the new vector that i created i was wondering if i need this line
vector<string>* row = new vector<string>;
and if i do i need to keep calling or is there a much better what to create a new row
heres a sample of the text file that we have to read in
Namibe # - # Mocamedes # NAM # Angola # Africa # F # 12076 # -1 # -1 # #
#
every string is sepearted by a # and a new row is seperated by a extra # and the end of the file has ###
StringTable::StringTable(ifstream & infile)
{
vector<string>* row = new vector<string>;
int i = 0,pound = 0;
string Tname;
bool sign;
while(pound != 3)
{
sign = readMultiWord(Tname,infile);
if(sign == false)
{
pound++;
if(pound != 2)
{
row->push_back(Tname);
i++;
}
}
else if(pound == 2)
{
table[i].push_back(Tname);
//table[i].push_back(*row);
pound = 0;
}
}
}
bool readMultiWord(string & s, ifstream & infile, const string & sep)
{
string w;
infile >> s;
if (s == sep)
return false;
infile >> w;
while (w != sep)
{
s += " " + w;
infile >> w;
}
return true;
}