Kesay hain ap sub umeed hai theak hon gy aj kafi dino bad sharing ker rha hu umeed hai ap ko passand aey gi.
dosto main students ka database rakhny k leay ek software bnaya socha ap k sath bhi share kru. ager passand aey to apni raey zrur dena.

CODE
#include<iostream>
#include<fstream>
#include<conio.h>
using namespace std;
class student
{
private:
int id;
char name[30];
char age[20];
char address[150];
char phone[20];
char qual[100];
char db[100];
public:
void getdata()
{
cout<<"Enter Student ID: ";
cin>>id;
cin.ignore();
cout<<"\nEnter Student Name: ";
gets_s(name);
cin.ignore();
cout<<"Enter Student Address: ";
gets_s(address);
cin.ignore();
cout<<"Enter Student Ph#: ";
gets_s(phone);
cin.ignore();
cout<<"Enter Student Age: ";
gets_s(age);
cin.ignore();
cout<<"Enter Student Qualification: ";
gets_s(qual);
cin.ignore();
cout<<"Enter Student Date Of Birth: ";
gets_s(db);
cin.ignore();
}
void showdata()
{
cout<<"\nID: "<<id<<endl;
cout<<"\nName: "<<name<<endl;
cout<<"\nAddress :"<<address<<endl;
cout<<"\nPh#: "<<phone<<endl;
cout<<"\nAge: "<<age<<endl;
cout<<"\nQualification: "<<qual<<endl;
cout<<"\nDate Of Birth: "<<db<<endl;
cout<<""<<endl;
}
int rtrnid()
{
return id;
}
};
void write_data()
{
student a;
ofstream fout;
fout.open("d:\\student.dat",ios::binary|ios::app);
a.getdata();
fout.write((char*)&a,sizeof(a));
fout.close();
}
void search (int n)
{
student a;
ifstream fin;
fin.open("D:\\student.dat",ios::binary);
while(fin.read((char*)&a,sizeof(a)))
{
if(a.rtrnid()==n)
{
cout<<"\nRecord For ID "<<n<<" Is Given Below\n ";
a.showdata();
break;
}
}
fin.close();
}
void del(int n)
{
student a;
ifstream fin;
fin.open("D:\\student.dat",ios::in|ios::binary);
ofstream fout;
fout.open("D:\\temp.dat",ios:ut|ios::binary);
while(fin.read((char*)&a,sizeof(a)))
{
if(a.rtrnid()!=n)
{
fout.write((char*)&a,sizeof(a));
break;
}
fin.read((char*)&a,sizeof(a));
}
fin.close();
fout.close();
remove("D:\\student.dat");
rename("D:\\temp.dat","D:\\student.dat");
}
void modify(int n)
{
fstream fout;
student a;
int found=0,cnt=0;
fout.open("d:\\student.dat",ios::ate|ios::in|ios:ut|ios::binary);
fout.seekg(0,ios::beg);
while( fout.read((char*)&a,sizeof(a)))
{cnt++;
if(a.rtrnid()==n)
{
found=1;
a.showdata();break;
}
}
if(found)
{
cout<<"\nModify Above Record: "<<endl;

fout.seekp((cnt-1)* sizeof(a));
a.getdata();
fout.write((char*)&a,sizeof(a));
cout<<"\nRecord Has Been Successfully Updated\n";

}
else cout<<"Record Not found";
fout.close();
}
void main()
{
int opt;
while(1)
{
system("CLS");
cout<<"====================="<<endl;
cout<<": Students Database :"<<endl;
cout<<"====================="<<endl;
cout<<""<<endl;
cout<<"<<<<< MAIN MENU >>>>>"<<endl;
cout<<""<<endl;
cout<<"1.Enter New Student Data"<<endl;
cout<<"2.Search Student Data"<<endl;
cout<<"3.Delete Student Data"<<endl;
cout<<"4.Modify Student Data"<<endl;
cout<<"0.Exit"<<endl;
cout<<"Enter your Option : ";
cin>>opt;
switch(opt)
{
case 1:
{
system("CLS");
cout<<"<<< NEW STUDENT ENTRY >>>"<<endl;
cout<<""<<endl;
write_data();
cout<<"\nYour Data Has Been Recoded\n";
cout<<"\nPress Any Key For Main Menu";
getch();
break;
}
case 2:
{
system("CLS");
cout<<"<<< STUDNET SEARCH >>>"<<endl;
cout<<""<<endl;
int n;
cout<<"Enter Student ID to Search Record: ";
cin>>n;
search(n);
cout<<"\nPress Any Key For Main Menu";
getch();
break;
}
case 3:
{
system("CLS");
cout<<"DELETE STUDENT RECORD"<<endl;
cout<<""<<endl;
int b;
cout<<"Enter Student ID You Want To Delete: "<<endl;
cin>>b;
del(b);
cout<<"\nRecord of "<<b<<" Has been Deleted"<<endl;
cout<<"\nPress Any Key For Main Menu";
getch();
break;
}
case 4:
{
system("CLS");
cout<<"MODIFY STUDENT RECORD"<<endl;
cout<<""<<endl;
int b;
cout<<"Enter Student ID To Modify RECORD: "<<endl;
cin>>b;
modify(b);
cout<<"\nPress Any Key For Main Menu";
getch();
break;
}
case 0:
{
exit(0);
}
default:
{
cout<<""<<endl;
cout<<"Invalid Input"<<endl;
cout<<""<<endl;
}
}
}
system ("pause");
}