C++ 如何在C++;?

C++ 如何在C++;?,c++,vector,C++,Vector,我有一个结构向量“数组”,看起来像 struct competitor { vector<string> name; vector<int> points; }; struct竞争对手 { 载体名称; 矢量点; }; 我有一个文件,其中包含名称和10个结果点,我想读入,但我不能附加到向量。我看不懂 int i = 0; string tmp; while(!x.eof()) { getline(x, tmp, '\t'); t[i].na

我有一个结构向量“数组”,看起来像

struct competitor
{
    vector<string> name;
    vector<int> points;
};
struct竞争对手
{
载体名称;
矢量点;
};
我有一个文件,其中包含名称和10个结果点,我想读入,但我不能附加到向量。我看不懂

int i = 0;
string tmp;

while(!x.eof())
{
   getline(x, tmp, '\t');
   t[i].name.push_back(tmp);
   // tmp >> t[i].name;
   cout << tmp << endl;

   for(int i = 0; i < 11; i++)
   {
       x >> tmp;
       t[i].pontok.push_back(tmp);
   }
   i++;
}
inti=0;
串tmp;
而(!x.eof())
{
getline(x,tmp,'\t');
t[i].name.push_-back(tmp);
//tmp>>t[i].名称;
couttmp;
t[i].pontok.push_-back(tmp);
}
i++;
}

for(int i=0;i尝试跟踪代码,换句话说,在“纸上”执行代码)一步一步地调试它。在循环时间、eof检查、甚至变量正确初始化方面都要非常小心。修复发现错误的每一步,直到代码没有错误。但我不知道文件有多长,但我知道有名称和10points@MariusBancila当前位置不,是10。如果它说我