o3
(文字列からの単語を保持するベクトル)とo4 (a vector to hold those vector of words). In the if statement, once ";" has been found in the vector
o3 [i] , I want to stop putting words from that
o3 [i] `をo4に作成しました。 o3で保持されている次の行に進みます。 "非標準構文で '&'というメンバへのポインタを作成する際にエラーが発生しました"というエラーでコメントされた行にあります。どんな助けも高く評価されます。ありがとう!非標準構文では、メンバーC++へのポインタを作成するために '&'を使用します。
while (getline(myfile, line, (char)32)) // first read entire line into a
//string
// problem : this also reads empty lines
// and gives error
// while returning words
{
abc2.push_back(line); // inserting individual strings into a vector
//cout << abc[i] << "\n"; // use this to see
// them as a vector of lines
//i++;
}
for (int i = 0; i < abc.size(); i++)
{
single_line = abc[i];
if (((single_line[0] >= 'A') && (single_line[0] <= 'Z')) ||
((single_line[0] >= 'a') && (single_line[0] <= 'z')))
{
if (abc[i] != "")
{
o3 = output_words(abc[i], (char)32); // function to separate
//words in a line
int j1 = 0; int j2 = 0;
while (j2 < o3.size())
{
if (o3[j2] != "" && "\t") // *IMP* require this line to
// get words
// irrespective of spaces
{
if (o3[j2].find != ";") // ERROR
{
o4.resize(i + 1);// NO CLUE WHY IT WORKED WITH
// i+1 resize???!!!
o4[i].push_back(o3[j2]);
j2++;
}
else
{
j2++;
}
}
else
{
j2++;
}
}
}
}
else
{
o3 = { "" }; // o1 will be null vector (i.e will contain
// nothing inside)
o4.push_back(o3);
}
}
[mcve] – Slava
を含むように質問を編集してください。おそらく 'if(o3 [j2] .find( ';')== std :: string :: npos)'またはその変形です。あなたは何を探したいのか、一度見つかった、または見つからなかったことを計画していることを説明してください。 –
この質問の対象はどのように関連していますか? – Slava