delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/09/23/16:26:31

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: person0000000000 AT yahoo DOT com (Person)
Newsgroups: comp.os.msdos.djgpp,comp.lang.c++,alt.comp.lang.learn.c-c++
Subject: More than one letter input
Date: 3 Dec 2001 17:21:44 -0800
Organization: http://groups.google.com/
Lines: 22
Message-ID: <91509768.0112031721.1481a4ee@posting.google.com>
NNTP-Posting-Host: 172.170.231.227
X-Trace: posting.google.com 1007428904 22455 127.0.0.1 (4 Dec 2001 01:21:44 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 4 Dec 2001 01:21:44 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie 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 <iostream.h>

  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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019