I have the following C++ code:
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cstring>
using namespace std;
int main() {
istringstream inSS;
string title;
string col1;
string col2;
string val;
int numCommas;
vector<string> stringData();
vector<int> intData();
cout << "Enter a title for the data:" << endl;
getline(cin, title);
cout << "You entered: " << title << endl << endl;
cout << "Enter the column 1 header:" << endl;
getline(cin, col1);
cout << "You entered: " << col1 << endl << endl;
cout << "Enter the column 2 header:" << endl;
getline(cin, col2);
cout << "You entered: " << col2 << endl << endl;
while (1) {
cout << "Enter a data point (-1 to stop input):" << endl;
getline(cin, val);
if(strcmp(val.c_str(), "-1") == 0) {
break;
}
inSS >> stringData >> intData;
cout << "Data string: " << stringData << endl;
cout << "Data integer: " << intData << endl;
}
return 0;
}
Error in question:
main.cpp: In function 'int main()': main.cpp:46:9: error: no match for 'operator>>' (operand types are 'std::istringstream {aka std::cxx11::basic_istringstream<char>}' and 'std::vector<std::cxx11::basic_string<char> >()')
inSS >> stringData >> intData;
~~~^~~~~~~~~~~
What does this error mean? How do I fix it?