| Forum |
|
|||||||
| Programming The destination for developers - C, C++, Java, Python and the lot |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Apprentice
Join Date: Nov 2006
Posts: 76
|
when i scan a character first then it will be scaned.... but when i want to scan a integer and then charcter..... it will not be accepted and program ends... I don't want to use any kind of 'flush' like flushall,fflush....etc. what is the problem..???
__________________
HHJobanputra |
|
|
| Advertisements. Register and be a member of the community to get rid of them. | |
|
Advertisement
|
|
|
|
#3 (permalink) |
|
Alpha Geek
Join Date: Mar 2006
Location: Delhi / Jaipur
Posts: 761
|
pl describe ur problem
__________________
My RIG: C2D 2.0Ghz + Intel965 Mobo + OCZ Matched Pair 2X1GB DDR2 800Mhz + LG L226WTQ 22" LCD + CM 500W PSU + Palit HD 4850 512GDDR3 HOMEPAGE : http://www.ashfame.com | BLOG : http://blog.ashfame.com |
|
|
|
|
#5 (permalink) |
|
God of Mistakes...
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,905
|
I think it's bcoz of '\n' character remains in buffer.
If u want to override this problem then u have to flush the buffer anyhow.
__________________
Registered Linux User #468778 ---------------------------------- http://twitter.com/_Garbage_ |
|
|
|
|
#6 (permalink) | |
|
C# Be Sharp !
Join Date: Jun 2006
Location: Toronto
Posts: 1,805
|
Quote:
to solve this use cin.ignore() function after every input to clear the newline character left in the buffer
__________________
There are 10 types of people in the world: those who understand binary and those who do not. |
|
|
|
|
|
#7 (permalink) | |
|
God of Mistakes...
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,905
|
Quote:
__________________
Registered Linux User #468778 ---------------------------------- http://twitter.com/_Garbage_ |
|
|
|
|
|
#9 (permalink) |
|
Alpha Geek
Join Date: Feb 2007
Posts: 935
|
if u r accepting single characters as input .. then u can use getch() ir getche() in ur prog ... but if u want to enter integers (mean more than 1 char ) to skip the "\n" u have to use flushing ..........
|
|
|
|
|
#11 (permalink) |
|
In The Zone
Join Date: Oct 2004
Posts: 437
|
for any kind of c programming codes i have found this site very helpful for academic purpose...it is just starting but i can see very good C programming library already...
i hope it is helpful for acedemic purpose http://visitguru.com/forum/viewforum.php?f=23 have a look
__________________
be who u r : |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unix(shell Programming) and TCP/IP programming tutorials | Matrix | Programming | 4 | 08-04-2008 09:54 PM |
| programming............ | Mohnishgs | Programming | 18 | 18-05-2007 07:57 PM |
| Need sme help in programming | dashang | Tutorials | 2 | 12-05-2007 10:56 PM |
| 'Assembly Language Programming' Problem | a_to_z123 | Programming | 5 | 03-12-2005 02:51 PM |
| Programming Help | demoninside | Programming | 4 | 10-04-2005 11:30 PM |