一个小的条件循环,总是在if(word= =8(or13))时出现问题大问题,请大神帮忙!
下面这个小程序为什么总是在if(word= =8(or13))时出现问题#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string filename, str;
int word;
vector<string> svec;
cout << "输入文件名称" << endl;
cin >> filename;
ifstream infile(filename.c_str());
if (!infile) return -1;
while (getline(infile, str))
{
svec.push_back(str);
}
infile.close();
istringstream sstream;
vector<string>::const_iterator ite = svec.begin();
begin:
while (ite != svec.end())
{
sstream.str(*ite);
while (sstream >> word)
{
if (word = =12)
{
++ite;
cout << *ite << endl;
sstream.clear();
goto begin;
}
}
sstream.clear();
++ite;
}
system("pause");
return 0;
}