I added a line to this program to read the length of the the string , then display the test. strlen() is not cooperating! Am I using the wrong function? the compiler says the arg should be char*. I'm confused!
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector <string> strv;
int main()
{
string input;
do
{
getline (cin,input);
strv.push_back(input);
}
while(input !="x");
cout << "exited first loop" << endl;
vector <string>::iterator itr = strv.begin(); //put itr init here instead
while (itr != strv.end())
{
cout<< << "length= "<< strlen(*itr) << " "<< *itr++ << endl;
}
return 0;
}