Solution for Problem 3:

Code: c++
int WriteStruct(Student A)
{      ofstream FileOut("xyz.txt",ios::binary);
        if (ios::fail) return -1;
        fin.write((char *)(&A), sizeof(A));
        return 0;
}