

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A c++ implementation of a student record management system that utilizes variable-length records. The system allows users to perform various operations such as packing, unpacking, searching, modifying, and deleting student records. The code includes classes and functions to handle these tasks, including reading and writing to a file. A detailed overview of the program's functionality, showcasing its ability to efficiently manage student data using variable-length records. This implementation could be useful for students or professionals interested in learning about file handling, data structures, and object-oriented programming in c++.
Typology: Summaries
1 / 3
This page cannot be seen from the preview
Don't miss anything!
#include
void student::read_file() { fstream fp; fp.open("3.txt",ios::in); while(!fp.eof()) { buffer.erase(); getline(fp,buffer); unpack(); if(!fp.eof()&& buffer[0]!='') display(); } fp.close(); } void student::unpack() { int i=0; usn.erase(); while(buffer[i]!='|') usn+=buffer[i++]; i++; name.erase(); while(buffer[i]!='|') name+=buffer[i++]; i++; sem.erase(); while(buffer[i]!='$') sem+=buffer[i++]; } void student::display() { cout<<"Usn:"<<usn<<" Name:"<<name<<" Sem:"<<sem<<endl; } int student::search1(string regno) { fstream fp; int recno=0,flag=0,pos=0; fp.open("3.txt",ios::in); while(!fp.eof()) { buffer.erase(); getline(fp,buffer); if(buffer[0]!='') //check the buffer ==* recno++; unpack(); if(usn==regno) { cout<<"\nRecord is "<<buffer; cout<<"\nRecord Found at Position "<<recno; pos=fp.tellg(); flag=1; return pos; } } fp.close(); if(!flag)