Page 161 - C++
P. 161
char From[20]; // Train Starting Point
char To[20]; // Train Destination
public:
char * StartFrom ( ); { return From; }
char * EndTo( ); { return To; }
void input() { cin>>Tno>>; gets(From); get(To); }
void show( ) { cout<<Tno<< “:”<<From << “:” <<To<<endl; }
};
OR
(b ) Write a function in C++ to add more new objects at the bottom of a binary file "Faculty.dat", assuming the
binary file is containing the objects of the following class : (3)
class Teacher
{
int Tno;
char Sname[20];
public:
void Enter()
{
cin>>Tno;gets(Sname);
}
void show()
{
count << Tno<<Sname<<endl;
}
};
(c) Observe the program segment given below carefully, and answer the question that follows: (1)
class Applicant
{
long AId;
char Name[20];
float score;
public:
void Enroll();