程
程
序
序
逻
逻
辑
辑
经
经
常
常
对
对
决
决
定
定
程
程
序
序
下
下
一
一
步
步
怎
怎
样
样
执
执
行
行
的
的
条
条
件
件
进
进
行
行
测
测
试
试
执行一个任务
如果这个任务没有正确执行
则执行错误处理
执行下一个任务
如果该任务没有正确执行
则执行错误处理
…
int main()
{
ifstream inCredit( "credit.dat");
if ( !inCredit )
{ cerr << "File could not be opened." << endl;
exit( 1 ); }
……
}
int fun( int a, int b)
{
if (b==0)
{ cerr << “can’t be divided by zero." << endl;
exit( 1 ); }
……
}