A 2 Database
A 2 Database
#include <string.h>
using namespace std;
class student
{
public:
int roll_no;
char clas[10];
int sr_no;
long int tele_no;
char name[20];
char div;
char blood_grp;
char DOB[10];
static int count;
void getdata();
friend void display(student &obj);
student() // Constructor
{
roll_no = 0;
cout << "\tConstructor";
roll_no = count;
count++;
}
~student() // Destructor
{
cout << "\nDestructor";
cout << "\nDestroying the object";
count--;
}
student(int roll_no)
{
this->roll_no = roll_no;
}
student(student &obj)
{
roll_no = obj.roll_no;
strcpy(name, obj.name);
strcpy(DOB, obj.DOB);
strcpy(clas, obj.clas);
blood_grp = obj.blood_grp;
div = obj.div;
tele_no = obj.tele_no;
sr_no = count;
count++;
}
};
void student::getdata()
{
cout << "\n"
<< "Enter the roll number of the student:";
cin >> roll_no;
int main()
{
student s1;
student s2(s1);
cout << "\n Enter the details of a student:"<< "\n";
s1.getdata();
int i, n;
student *s[50];
cout << "\nEnter how many student object do you want us to create?"
<< "\n";
cin >> n;