#include<iostream>
using namespace std;
#include<iostream>
using namespace std;
//异常类
class PerformanceError{};
class DesignError{};
class ProvideError{};

class MaterialError: public ProvideError,public PerformanceError{};
class ShellError : public DesignError{};
//汽车生产函数
void carPackage();
void shellPackage();
void partsProduce();
//测试函数
void performanceText();
void surfaceDesign()
void materialProvide(); 
int main()
{
	carPackage();
        return 0;
}
void carPackage()
{
	try
	{
		shellPackage();
	}
	catch(ShellError&)
	{
		cout<<"Shell error!"<<endl;
	}
	catch(MaterialError&)
	{
		cout<<"Material error!"<<endl;
	}
	catch(...)
	{
		cout<<"Other error!"<<endl;
	}
}
void shellPackage()
{
	try
	{
		 partsProduce();
	}
	catch(DesignError&)
	{
		cout<<"Design Error"<<endl;
		throw  ShellError();
	}
	catch(...)
	{
		throw  MaterialError();
	}
}
void partsProduce()
{
	try
	{
		performanceText();
		surfaceDesign();
	    materialProvide();
	}
	catch(PerformanceError&)
	{
		cout<<"Performance Error"<<endl;
		throw;
	}
	catch(ProvideError&)
	{
		cout<<"Provide Error"<<endl;
		throw;
	}
	catch(...)
	{
		throw;
	}
}
void performanceText()
{
	bool flag;
	cout<<"Is the performanceText OK? 1-OK;  0-ERROR"<<endl;
	cin>>flag;
	if(!flag)
        throw PerformanceError();
}
void surfaceDesign()
{
	bool flag;
	cout<<"Is the surfaceDesign OK? 1-OK;  0-ERROR"<<endl;
	cin>>flag;	
	if(!flag)
       throw DesignError();
}
void materialProvide()
{
	bool flag;
	cout<<"Is the materiaProvide OK? 1-OK;  0-ERROR"<<endl;
	cin>>flag;
	if(!flag)
       throw ProvideError();
}

