c ++ – Inserting into a sorted file

Try to insert data into a sorted file (maintained through classes). I can search and add easily enough, but the code does not work during insertion.
Class:

class student
{
int rollno;
Character name[20];
tank branch[3];
floating marks;
char degree;

public:
empty getdata ()
{
cost <<"Rollno: ";
            cin>> rollno;
cost <<"Name: ";
            cin>> name;
cost <<"Branch: ";
            cin>> branch;
cost <<"Marks: ";
            cin>> brands;

if (marks> = 75)
{
note = 'A';
}
if not (marks> = 60)
{
note = & B;
}
if not (marks> = 50)
{
note = C #;
}
if not (marks> = 40)
{
note = "D";
}
other
{
note = F #;
}
}

void putdata ()
{
cost << "Rollno:" << roll << <<  tName: "<< name <<"  n ";
cost << "Marks:" << marks << " tGrade:" << grade << " n";
}

int getrno ()
{
return rollno;
}
} stud1;

main:

                int main ()
{


fstream fio ("marks.dat", ios :: in | ios :: out);
char ans = & # 39; y & # 39;
while (years == & ysp; y | y = y & # 39;)
{
stud1.getdata ();
fio.write ((char *) & stud1, sizeof (stud1));
cout << "Record added to file  n"; `
cost <<"nWant to enter more ? (y/n)..";
        cin>> years;
}


int rno;
long pos;
char found = & # 39; f;

cost <<"Enter rollno of student to be search for: ";
    cin>> rno;

fio.seekg (0);
while (! fio.eof ())
{
pos = fio.tellg ();
fio.read ((char *) & stud1, sizeof (stud1));
if (stud1.getrno () == rno)
{
stud1.putdata ();
fio.seekg (pos);
found = & # 39; t;
Pause;
}
}
if (found == & # 39;)
{
cout << " nRecord not found in file .. !!  n";
cout << "Press any key to exit ...  n";
getch ();
output (2);
}

fio.close ();
getch ();
}