View Single Post
Old 17-06-2007, 02:08 PM   #6 (permalink)
Zeeshan Quireshi
C# Be Sharp !
 
Zeeshan Quireshi's Avatar
 
Join Date: Jun 2006
Location: Toronto
Posts: 1,805
Default Re: C programming problem

Quote:
Originally Posted by hrushij
I have a prablem with a program...
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..???
yups , u have the "/n" character in still left in your buffer which gives the illusion that the input statement is being skipped .

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.
Zeeshan Quireshi is offline