i try to write a program using class that take number of particulars of sibling and take the name and age of each particulars from user and allocated seats. but my program has some error and does not compile and run. my code is:

//header files

//class definition
class Sibling
//hidden part
//for Sibling's name
char name[25];
//for Sibling's age
int age;
//for Sibling's seat number
int pass_seat_num;
//for keeping track of alloted seats
static int seat_num;

//setter for Sibling name
void set_name(char* name);
//setter for sibling age
void set_age(int age);
//getter for Sibling name
char* get_name();
//getter for sibling age
int get_age();
//display function
void display();



//initializing static data member
int Sibling::seat_num = 0;

pass_seat_num = ++seat_num;

//setting name
void Sibling::set_name(char* name1)
for(int i=0;i<25;i++)

//getting name
char* Sibling::get_name()
return name;
void Sibling::set_age(int age1)
for(int i=0; i<50;i++)
//getting age
int Sibling::get_age()
return age;

//display function to display passengers names and age  w.r.t alloted seat numbers
void Sibling::display()

cout<<get_name()<<" alloted  "<<pass_seat_num;

//main function
int main()
//for number of Sibling
int num=0;
//for name
char name[25];

//taking input of number of Sibling
cout<<"Please enter the number of Sibling:   ";
cout<<"Please enter the particulars eachs of Sibling:   "<<endl;
//declaring Sibling object
Sibling* p;
//creating array of objects
p= new Sibling[num];

//declaring Sibling object
Sibling temp;

//taking input for the name of all Sibling
for(int i=0;i<num;i++)
cout<<endl<<"Please enter the particulars of Sibling: "<<i+1;
cout<<endl<<"\n\t\tName:     ";
cout<<endl<<"\n\t\tAge:     ";


//calling display w.r.t each object
for(int i=0;i<num;i++)


//deleting array of objects
delete []p;
return 0;

Recommended Answers

All 3 Replies

1.Use code tags
2.It should be conio.h(you should avoid using non-standard headers)
3.Use <iostream> instead of <iostream.h>
4.Lot of typing mistakes
and lot of other issues....

and give us the compile errors.

well one u defined i twice in 2 diff functions and u didnt declare a couple of things or declared them wrong

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.