V
vikas
how can I make getline(cin, somestring) make skip initial white spaces,
say if i enter " a" length should be 1.
why do i need to hit enter twice after getline to display what i got?
how to over come that?
example:
int main(int argc, char* argv[])
{
string s;
string::size_type len;
cout << "enter some string" ;
getline(cin, s);
len = s.length();
cout << len;
return 0;
}
say if i enter " a" length should be 1.
why do i need to hit enter twice after getline to display what i got?
how to over come that?
example:
int main(int argc, char* argv[])
{
string s;
string::size_type len;
cout << "enter some string" ;
getline(cin, s);
len = s.length();
cout << len;
return 0;
}