#include<iostream.h>
#include<conio.h>
#include<string.h>
class first
{
private:
int tranum;
char name[30];
public:
void getdata();
void putdata();
};
class second
{
private:
char source[30];
char dest[30];
public:
void getdata();
void putdata();
};
class third
{
private:
first obj1;
second obj2;
public:
void getdata();
void putdata();
};
void first :: getdata()
{
cout<<"Train no. : ";
cin>>tranum;
cout<<"Name. : ";
cin>>name;
}
void first :: putdata()
{
cout<<"Train no. : "<<tranum<<endl;
cout<<"Name. : "<<name<<endl;
}
void second :: getdata()
{
cout<<"Source. : ";
cin>>source;
cout<<"Destination : ";
cin>>dest;
}
void second :: putdata()
{
cout<<"Source. : "<<source<<endl;
cout<<"Destination : "<<dest<<endl;
}
void third :: getdata()
{
obj1.getdata();
obj2.getdata();
}
void third :: purdata()
{
obj1.putdata();
obj2.putdata();
}
int main()
{
class third obj[10];
int n, i;
clrscr();
cout<<"How many records to enter : ";
cin>>n;
cout<<"***Enter the data***"<<endl;
for(i=0; i<=n-1; i++);
{
cout<<"Record No. "<<i+1<<endl;
obj[i].getdata();
}
cout<<endl<<"***The enter data is ***";
for(i=0; i<=n-1; i++);
{
cout<<"Record No. "<<i+1<<endl;
obj[i].putdata();
}
return 0;
getch();
}
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement 
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

Program to demonstrate the use of nested classes taking example of train information.

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1 Program to enter the information of an employee and then display it using the single inheritance concept (one base class and one derived class).
2 Program to enter the information of a student and then display it using the single inheritance concept.
3 Program to enter the information of x number of student and display it using the multilevel inheritance concept.
4 Program using multilevel inheritance to get the data from two base classes and display it using the derived class.
5 Program to demonstrate the use of nested classes taking example of train information.
6 Write a C++ program to read and display information about employees and managers. Employee is the base class and Manager is the sub class.
7 The following incomplete program takes information about students and their marks and their displays their result. Complete it by filling up their blanks (Grade is ‘A’ for percentage>=60.00, ‘B’ for 50-55.99 ‘C’ for 40-49.99 and ‘D’ for<40).
8 A railway reservation counter needs to computerize its reservation process. Using the following information write C++ Program to do so.

 

     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement