Hello. I am creating a program to read the data from a file, remove the quotations from the words and store the words without quotations in a vector. However, I am getting this compiling error that I cannot interpret. The code and compiler error are below, and here is a link to the text file: http://projecteuler.net/project/words.txt
#include <iostream>
#include <vector>
#include <cmath>
#include <fstream>
usingnamespace std;
int main() {
//read from "words.txt" into data
ifstream infile;
infile.open("words.txt");
string data;
infile >> data;
infile.close();
//breaks the words apart and stores them in vector
vector<string> words;
vector<string> tempWords = ""; //"buffer" for words
long ch = 1;
while(ch < tempWords.size()) {
while(data[ch] != '\"') {
tempWords = tempWords + data[ch];
++ch;
}
words.push_back(tempWords);
ch+=3;
}
cout << words[0] << words[1] << words[3];
return 0;
}
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/vector:550:5: note:
candidate constructor not viable: no known conversion from
'const char [1]' to 'const std::__1::vector<std::__1::basic_string<char>,
std::__1::allocator<std::__1::basic_string<char> > > &' for 1st argument
vector(const vector& __x);