Find the output of the following program:
#include<iostream.h>
class METRO
{
int Mno, TripNo,PassengerCount;
public:
METRO (int Tmno=1)
{
Mno=Tmno;TripNo=0;PassengerCount=0;
}
void Trip(int PC=20)
{
TripNo++;PassengerCount+=PC;
}
void StatusShow()
{
cout<<Mno<<':'<<TripNo<<':'<<PassengerCount<<endl;
}
};
void main()
{
METRO M(5),T;
M.Trip();
T.Trip(50);
M.StatusShow();
M.Trip(30);
T.StatusShow();
M.StatusShow();
}
Output of the given code:
5:1:20
1:1:50
5:2:50