![]() |
|
#1
|
|||
|
|||
is it possible to use cin.getline in stringshey guyz what's up? my question is same as the title above. is it any way possible for you to use cin.getline in strings.if not then how do i read a whole line in this code. it's all the way at the bottom.
CPP / C++ / C Code:
when i run the program it asks me to enter a name for member # 1. it did so but if i put the whole name in like Kevin Lucas and press enter it will come like this please enter the data for member # 1 //i entered the whole name it will display this: please enter the data for member# 2 please enter the data for member #3 so basically it will skip the 2nd one. whenever i enter the whole name it will skip. how can i fix this. |
|
#2
|
|||
|
|||
Re: is it possible to use cin.getline in strings[quote=Mrehman is it any way possible for you to use cin.getline in strings.[/QUOTE]
CPP / C++ / C Code:
I respectfully suggest that you to get a book or check an online reference such as http://www.cplusplus.com/reference/string/getline.html I mean, it's OK to ask, but wouldn't either of these be quicker than posting a request for help and waiting for a helpful response? Regards, Dave Footnote: Note that cin.getline() is for char arrays. The global function getline() for std::strings is used as I show. In my opinion, there is rarely a (good) reason to use char arrays for things like this in a C++ program. Last edited by davekw7x : 06-May-2008 at 12:01.
|
|
#3
|
|||
|
|||
Re: is it possible to use cin.getline in stringscin takes input as space delimited.
example: CPP / C++ / C Code:
Code:
|
|
#4
|
|||
|
|||
Re: is it possible to use cin.getline in stringsThanks guyz.
|
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| strings?!!!! :S | nooranshasi | C Programming Language | 17 | 18-Nov-2006 19:58 |
| binary search on vector of objects sorted by strings | qboy | C++ Forum | 8 | 13-Oct-2006 20:14 |
| Menu of character strings | aijazbaig1 | C Programming Language | 21 | 27-Jul-2006 03:07 |
| need help - questions about strings | Benayoun | C Programming Language | 6 | 24-Jan-2005 02:15 |
| C++ style strings and STL | dexter | C++ Forum | 14 | 04-Jan-2005 07:46 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The