当程序测试并处理关键错误是,不希望程序的错误信息从屏幕显示重定向到其他地方,我们用cerr
如void f(int a,int b)
{
if(b==0)
cerr<<"helo"<<endl;
}
else
cout<<a/b;}void main()
{
f(20,2);
f(20,0);
}运行是:
c:>abc.txt
helo
abc.txt为10
如void f(int a,int b)
{
if(b==0)
cerr<<"helo"<<endl;
}
else
cout<<a/b;}void main()
{
f(20,2);
f(20,0);
}运行是:
c:>abc.txt
helo
abc.txt为10
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货