Chapter – 5. CONSTRUCTORS & DESTRUCTORS

Ans:

#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<iostream.h>
class Tour
{
char TCode[21];
int NoofAdults,NoofKids,Kilometres;
float TotalFare;
public: Tour( ) strcpy(TCode,"NULL");
{
NoofAdults=NoofKids=Kilometres=TotalFare=0;
}
void AssignFare( )
if(Kilometres>=1000)
{
TotalFare=NoofAdults*500+NoofKids*250;
else if(Kilometres>=500) TotalFare=NoofAdults*300+NoofKids*150;
else TotalFare=NoofAdults*200+NoofKids*100;
}
void EnterTour( )
cout<<"\nEnter the Tour Code: ";
{
gets(TCode);
cout<<"\nEnter the Number of Adults: ";
cin>>NoofAdults;
cout<<"\nEnter the Number of Kids: ";
cin>>NoofKids;
cout<<"\nEnter the Number of Kilometres: ";
cin>>Kilometres; AssignFare( );
}
void ShowTour( )
{
cout<<"\nThe Tour Code: "<<TCode;
cout<<"\nThe Number of Adults: "<<NoofAdults;
cout<<"\nThe Number of Kids: "<<NoofKids;
cout<<"\nThe Number of Kilometres: "<<Kilometres;
cout<<"\n\nThe Total Fare: "<<TotalFare;
}
};
void main( )
{
clrscr();
Tour T;
T.EnterTour( );
T.ShowTour( );
getch();
}


Warning: include_once(../../ebooks-footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter5_f.php on line 129

Warning: include_once(): Failed opening '../../ebooks-footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter5_f.php on line 129

Warning: include_once(../../../footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter5_f.php on line 131

Warning: include_once(): Failed opening '../../../footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter5_f.php on line 131