PO> I am fairly new at C++ and i have encountered a pretty major
Well, welcome to hell, kid. Now every two bit that wanders into town
will be trying to take you down, just to make a name for himself.
Well you asked for it.
PO> to use 'getline' in its place. However 'getline' doesn't work all
PO> the time either especially when i do something like:
PO>
PO> char name[20];
PO> cout<<"Enter name: ";
PO> getline(name, cin);
PO>
PO> It just wont work. How would I remedy this problem without
PO> limiting the user to just their first or last name.
Probably won't even compile, !!! Try this one instead :
cin.getline ( name , 20 ) ;
cin is an object of class istream. The istream class has the getline
method defined as a class member method. Which compiler are
you using, just for my curiosity?
Thanks
Peter
---
þ KWQ/2 1.2i þ Microsoft's Motto: We're the leaders, wait for us!
---------------
* Origin: St. Louis Users Group (1:100/4)
|