c++ - How to avoid multiple print in screen? -


i wrote sample program on c++ print student's markdetails using while loop. print records properly. last record print 2 times in screen. have checked in file, there correct. sample code below.

fread.open("marks.inf",ios::in);             {             fread>>name1>>mm1>>mm2>>mm3>>mm4>>mm5;             cout<<name1<<'\t'<<mm1<<'\t'<<mm2<<'\t'<<mm3<<'\t'<<mm4<<'\t'<<mm5<<'\t'<<endl;         }     while(fread);     fread.close(); 

my output is:

dinu    90  90  90  90  88   venis   96  49  90  88  78   veni    89  89  88  78  66   veni    89  89  88  78  66 

in output, veni print 2 times in screen. how avoid issue?


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -