问题 填空题

使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正错误,使程序正常运行,并且要求最后一个catch必须抛出执行的任何异常。
程序异常,输出信息为
error
0
ERROR
注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在//******error******的下面。
试题程序:
#include<iostream.h>
int main()

try

throw("error");

//********error********
catch(char s)

cout<<s<<end1;

try

throw((int)0);

//********error********
catch()

cout<<i<<end1;

try

throw(0);
throw("error");

//********error********
catch()

cout<<"ERROR"<<end1;

return 0;

答案

参考答案:应改为“catch(char *s)”。

选择题
单项选择题 共用题干题