void kbc::sce() // member function of class kbc
{ clrscr();
ifstream ifs("SCORE.TXT"); // a file stores score after game is played
if(ifs.eof()) // checking whether any score stored and printing
{ gotoxy(15,15);
cputs(" No score registered \n");
getch();
}
elseif(!ifs.eof())
{while(!ifs.eof())
{ ifs.read((char*) &t,sizeof(t)); // 't' is object of class kbc
if(ifs.eof())
break;
t.score();
}
} getch();
ifs.close();
}
This is working for infinite times unless any record is available for it to be read.
@chipp
I like how you have stolen this thread ;)
Be more specific what you mean by "back to normal". cin.clear() will clear the error flags of the stream so that you can read from it again.
@chipp
I like how you have stolen this thread ;)
Be more specific what you mean by "back to normal". cin.clear() will clear the error flags of the stream so that you can read from it again.
hahaha... sorry dude, don't realized that i hijacked someone's thread...
@OP: excuse me bro...
@peter: what i mean is clear the input buffer of the stream... any links?
Because you didn't read the input. It remains in the buffer.
You need to discard it std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );