Originally Posted by
tabstop
If the cin.ignore() is used to remove unwanted \n characters, it needs to be done before the getline, not after it. (Unwanted \n characters are left in by >> operations, so the ignore function needs to follow those -- getline takes the \n characters as part of the input.)
HI tabstop, i've been doing this wrong anyway, should be
Code:
do
{
cout << "\nWork/Home Number [ccc-nnn-nnnn] : ";
getline(landline, 12); // Read up to 12 charactors
}
But am now getting errors
Code:
error C2784: 'std::basic_istream<_Elem,_Traits> &std::getline(std::basic_istream<_Elem,_Traits> &,std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'std::basic_istream<_Elem,_Traits> &' from 'std::string'
: see declaration of 'std::getline'