X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Thomas Hansen Newsgroups: comp.os.msdos.djgpp,comp.lang.c++,alt.comp.lang.learn.c-c++ Subject: Re: More than one letter input Date: Wed, 05 Dec 2001 08:21:34 +0100 Organization: adra match asa Lines: 38 Message-ID: <6lir0uk5hsktmolpboejm5mtpqm120da9q@4ax.com> References: <91509768 DOT 0112031721 DOT 1481a4ee AT posting DOT google DOT com> NNTP-Posting-Host: 193.71.234.202 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: oslo-nntp.eunet.no 1007536920 8079 193.71.234.202 (5 Dec 2001 07:22:00 GMT) X-Complaints-To: abuse AT KPNQwest DOT no NNTP-Posting-Date: 5 Dec 2001 07:22:00 GMT X-Newsreader: Forte Agent 1.8/32.553 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On 3 Dec 2001 17:21:44 -0800, there came a drop of sanity from person0000000000 AT yahoo DOT com (Person) containing: >How can I get input for more than one letter (a whole word)?? >I want to make a simple program that asks you for your name, and then >shows it on the screen. > >This is what I have so far: > > #include > > main() > { > char name; > int x; > cout << "Name: "; > cin >> name; > cout << "Hello, " << name << "\n"; > } > >It only takes the first letter of the name. > >Can someone help me with this please? > >--Person #include // Standard header inclusion main() { using namespace std; string name; // Use string and not char int x; cout << "Name: "; cin >> name; cout << "Hello, " << name << "\n"; } -- "FOOT-AND-MOUTH BELIEVED TO BE FIRST VIRUS UNABLE TO SPREAD THROUGH MICROSOFT OUTLOOK"