C++ 把这些垃圾从我的向量中拿出来

C++ 把这些垃圾从我的向量中拿出来,c++,ifstream,C++,Ifstream,我想消除我在下面的向量synsAux上得到的垃圾。它应该打印: 1 7 7 1 我在第一位和第三位之前多了一个2,为什么?这是空白空间的ASCII值吗?我如何避免阅读 这是运行程序所需的字典文件: dictionary.txt 1 cute 2 hello 3 ugly 4 easy 5 difficult 6 tired 7 beautiful synonyms 1 7 7 1 antonyms 1 3 3 1 7 4 5 5 4 7 3 #包括 #包括 #包括 #包括 #包括 使用名

我想消除我在下面的
向量synsAux
上得到的垃圾。它应该打印:

1 
7
7
1
我在第一位和第三位之前多了一个2,为什么?这是空白空间的ASCII值吗?我如何避免阅读

这是运行程序所需的字典文件:

dictionary.txt
1 cute
2 hello
3 ugly
4 easy
5 difficult
6 tired
7 beautiful
synonyms
1 7
7 1
antonyms
1 3
3 1 7
4 5
5 4
7 3

#包括
#包括
#包括
#包括
#包括
使用名称空间std;
类WordInfo{
公众:
WordInfo(){}
~WordInfo(){
}
int id()常量{return myId;}
无效读字(istream&in)
{
在>>myId>>word中;
}
void同义词(字符串synline、向量词infovector)
{
弦流-弦流(弦线);
向量综合征;
int-num;
while(synstream>>num)synsAux.push_back(num);

cout您正在这里打印这两个:

cout<<synsAux.size();
可以吃我7秒。=)+1
cout<<synsAux.size();