0% found this document useful (0 votes)
20 views3 pages

Document 12

The document defines classes for student information, fees, and hostel. It creates objects of these classes and outputs the student name, roll number, department, fee payment status for different months.

Uploaded by

SAKSHAM SETIA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Document 12

The document defines classes for student information, fees, and hostel. It creates objects of these classes and outputs the student name, roll number, department, fee payment status for different months.

Uploaded by

SAKSHAM SETIA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

#include<iostream>

using namespace std;

class info {

protected:

char name[20];

int rollnumber;

char department[20];

public :

info() {cout<<"enter the name of the student =";

cin.getline(name,20);

cout<<endl<<"enter the rollnumber of the student =";

cin>>rollnumber;

cout<<endl<<"enter the department of the student =";

cin>>department;

};

class fees : public info

{protected :

const char **month;

int *fee;

int *ind;

static int size;

public :

fees() {size=6;

cout<<endl<<"information of student name :"<<name<<endl<<"rollnumber :


"<<rollnumber<<endl<<"department : "<<department<<endl;

month=new const char*[40];

for(int i=0;i<size;i++)

{month[i]=new char[40];
}

fee=new int[size];

ind=new int[size];

month[0]="jan";

month[1]="feb";

month[2]="march";

month[3]="april";

month[4]="march";

month[5]="june";

fee[0]=1200;

fee[1]=1200;

fee[2]=1000;

fee[3]=2000;

fee[4]=2000;

fee[5]=0;

ind[0]=1;

ind[1]=1;

ind[2]=0;

ind[3]=1;

ind[4]=1;

ind[5]=1;

};

class hostel : public fees

{ public :

hostel()

{for(int i=0;i<size;i++)

if(ind[i]==0)

cout<<month[i]<<" fee is not paid which is "<<fee[i]<<endl;


else

cout<<month[i]<<" fee is paid which is "<<fee[i]<<endl;

};

int fees :: size;

int main()

{hostel obj;

return 0;

You might also like