當我嘗試運行這個程序,我得到的是暫停程序,並說,「矢量下標越界」矢量下標超出範圍錯誤,C++
任何想法,我做錯了錯誤?
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
using namespace std;
//(int argc, char* argv[]
int main()
{
fstream bookread("test.txt");
vector<string> words;
bookread.open("test.txt");
if(bookread.is_open()){
cout << "opening textfile";
while(bookread.good()){
string input;
//getline(bookread, input);
bookread>>input;
//string cleanedWord=preprocess(input);
//char first=cleanedWord[0];
//if(first<=*/
//cout << "getting words";
//getWords(words, input);
}
}
cout << "all done";
words[0];
getchar();
}
http://stackoverflow.com/q/43108052/7276612[Doesn't似乎一直工作。我在哪裏錯了?] [1] – DamienArt1234 2017-03-30 20:30:34