class CarSystem:public Month
{ private:
struct node
{ bool GreenCollection;
bool Compact;
bool FullSize;
bool Suv;
node *link;
};
node *head;
public:
CarSystem();
string displayMonth(int);
void displayResult(CarSystem);
void reservation(Month);
bool ValidOfCar();
};
string CarSystem::displayMonth(int i)
{ switch (i)
{ case 1:cout<<"January";
break;
case 2:cout<<"February";
break;
case 3:cout<<"March";
break;
case 4:cout<<"April";
break;
case 5:cout<<"May";
break;
case 6:cout<<"June";
break;
case 7:cout<<"July";
break;
case 8:cout<<"August";
break;
case 9:cout<<"September";
break;
case 10:cout<<"October";
break;
case 11:cout<<"November";
break;
case 12:cout<<"December";
break;
}//end switch statement
}
void CarSystem::displayResult(CarSystem abc)
{ //node *current;
//current=head;
cout<<"_________________________________________________________________________"<<endl;
[color="#FF0000"]int y=1;
abc.displayMonth(y);[/color]
/*while(current->link!=NULL)
{ cout<<current->GreenCollection<<" "<<current->Compact<<" "<<current->FullSize<<" "<<current->Suv<<endl;
current=current->link;
}*/
}
If the red statement replace with
abc.displayMonth(1);
then the program can display January.
Why the above one cannot display and will crash?
This post has been edited by UrIkOn: 07 April 2012 - 10:21 PM

New Topic/Question
Reply



MultiQuote




|