Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: cin - Why Does It Require 2 Returns? Date: Sun, 21 Aug 2011 17:21:49 +1200 Lines: 28 Message-ID: <9bbivdF5rnU2@mid.individual.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 3dLgjAVNfi8NBCX9D/cmxA56PZ21O1XN+U98g644fKnYF6vE6o Cancel-Lock: sha1:4HV+MA/ckVVFWT1noFevSbAU8Qs= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:9128 On 08/21/11 04:12 PM, Geoff wrote: > On Sat, 20 Aug 2011 20:49:48 -0700, mrc2323@cox.net (Mike Copeland) > wrote: > >> In the following program, I must press "return" twice when I enter >> the string data. Why is that? TIA >> >> #include >> #include >> using namespace std; >> >> int main () >> { >> string mystr = ""; >> cout<< "What's your name? "; >> getline (cin, mystr); >> cout<< "Hello "<< mystr<< ".\n"; >> return 0; >> } > > Because you're using it wrong? > > cin>> mystr; What happens if the user enters "John Doe"? -- Ian Collins