diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..2e2cbcc --- /dev/null +++ b/main.cpp @@ -0,0 +1,164 @@ +#include +#include +#include +#include +#include + +using namespace std; + +class Student{ +int roll; +char name[25]; +float marks; + + + + + +void getdata() +{ +cout<<"\n\nEnter Roll:"; +cin>>roll; + +cout<<"\n\nEnter Name:"; +cin>>name; + +cout<<"\n\nEnter Marks:"; +cin>>marks; +} + +void putdata() +{ + cout<<"\n\t"<>nam; + cout<<"New marks:(Press -1 to retain old one)"; + cin>>mks; + if(strcmp(nam,".")!=0){strcpy(name,nam);} + if(mks!=-1)marks=mks; + cout<>rno; + while((fd.read((char*)&st,sizeof(st)))!=NULL) + { + if(st.getrno()!=rno) + { + flagd=1; + ft.write((char*)&st,sizeof(st)); + } + } + fd.close(); + ft.close(); + if(flagd==0)cout<<"\nSpecified student not found :"; + remove("Student.dat"); + rename("temp.dat","Student.dat"); + remove("temp.dat"); + cout<<"\nProcess complete"; +} + + +int main() +{ + int found=0; + Student S; + int op; + fstream fio; + + do + { + cout<<"\n1.Add\n"; + cout<<"2.Display\n"; + cout<<"3.Edit\n"; + cout<<"4.Delete\n"; + cout<<"5.Exit\n"; + cout<<"Enter the options\n"; + cin>>op; + switch(op){ + case 1:S.AddRecord();break; + case 2:S.Display();break; + case 3: fio.open("Student.dat",ios::in|ios::out); + int rno; + long pos; + //char found='f'; + + cout<<"Enter rollno of student whose record is to be modified:"; + cin>>rno; + cout<<"Beginning"<