EXplain me about these function

cin.clear();
cin.ignore();

tell me what function i use for flushing a input bufer in c and c++;

Recommended Answers

All 5 Replies

hello everyone,

#include <conio.h> //Include this file in your header

fflush(stdin); // This is to flush the input

I hope this helps you

Yours Sincerely

Richard West

hello everyone,

#include <conio.h> //Include this file in your header

fflush(stdin); // This is to flush the input

I hope this helps you

Yours Sincerely

Richard West

//FROM MY SIDE
HELLO DEAR fflush() FUNCTION BUFFERED THE OUTPUT STREAM NOT INPUT STREAM.SO,U'R COMMENT IS NOT TECHNICALLY CORRECT.PLS REPLY ME SOON.

to flush input buffer u can
#include <conio.h>
void main ()
{
/* code */
getch() ; //take input from keyboard buffer before displaying in the screen
/*rest of code*/
}
is this the answer to your question ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.