X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Neil Butterworth" Newsgroups: comp.os.msdos.djgpp,comp.lang.c++,alt.comp.lang.learn.c-c++ References: <91509768 DOT 0112031721 DOT 1481a4ee AT posting DOT google DOT com> Subject: Re: More than one letter input Date: Tue, 4 Dec 2001 01:31:34 -0000 Lines: 53 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: ppp-225-33-180.friaco.access.uk.tiscali.com Message-ID: <3c0c2755_3@mk-nntp-1.news.uk.worldonline.com> X-Trace: 4 Dec 2001 01:31:01 GMT, ppp-225-33-180.friaco.access.uk.tiscali.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Person" wrote in message news:91509768 DOT 0112031721 DOT 1481a4ee AT posting DOT google DOT com... > 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 This is not a standard C++ header file - you want #include > > main() In standard C++, main must return an int. > { > char name; > int x; > cout << "Name: "; > cin >> name; > cout << "Hello, " << name << "\n"; > } > > It only takes the first letter of the name. Because a char is only one letter. You need a string - a sequence of letters: #include #include using namespace std; int main() { string name; cout << "Name: "; cin >> name; cout << "Hello, " << name << "\n"; } All this should be covered in any beginners book on C++ - which one are you using? NeilB