I want to take infinite number of strings using string class.
Why string operator is not working in the following program?
it is showing...
error: no match for 'operator!=' in 'str != -0x000000001'|
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
vector<string> s_v;
string str;
for( ; ;)
{
getline(cin, str, '\n');
if(str != EOF) s_v.push_back(str);
else break;
}
return 0;
}
one more question, will
getline(cin, str, '\n');
this line will include '\n' at the end of each string?