www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/15/12:43:35

From: "Luis A. Espinal" <lespin03 AT solix DOT fiu DOT edu>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: Using cin.get() Outside Of main()
Date: Sat, 15 Mar 1997 07:35:28 -0500
Organization: Florida International University
Lines: 31
Message-ID: <332A978F.6E50@solix.fiu.edu>
References: <5f2ag5$l9m AT boursy DOT news DOT erols DOT com>
NNTP-Posting-Host: serss1.fiu.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> I prompt the user for input eg.
> 
> char FullName[256];
> cout << "Enter Your Full Name\n:";
> cin.get(FullName,256);
> 
> and the program compiles without error, but when I run it it skips
> right by the cin.get() and displays
> 
> Enter Your Full Name
> :
> (The rest of the program)
> 

Try something like this:

char FullName[256];

cin.ignore( SOME_BIG_NUMBER );

cout << "Enter Your Full Name\n:";
cin.get(FullName,256);


Hope it helps,
Luis Espinal
-- 
Luis++ = ( lespin03 AT solix DOT fiu DOT edu XOR 
	   luis_espinal AT armsfl DOT ccmail DOT compuserve DOT com );
What does not kill us makes us stronger
...abort, retry, ignore ?

- Raw text -


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