Cuando trato de ejecutar este programa me sale un error que detiene el programa y dice, "vector subíndice fuera de rango"vector subíndice error fuera de, C++
Alguna idea de lo que estoy haciendo mal?
#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[No parece funcionar todo el tiempo. ¿Dónde me estoy equivocando?] [1] – DamienArt1234