改为:
#include
main()
{
int i,j;
for(i=1;i<=5;i++)
for(j=1;j<=5;j++)
{ printf("i=%d,j=%d\n",i,j);
if(i+j==5)
goto label_1;
}
label_1:printf("好了");
}
你的“lable_1:printf("好了");”拼错了 是label,不是lable
#include
void main()
{
int y = 0;
rev:
try
{
cout<<"input a num\n";
cin>>y;
if(y==0)
throw y;
cout<<3/y;
}
catch(int x)
{
cout<<"error!\n";
goto rev;//显示错误 并跳转到上述语句继续运行程序。
}
}
不要从try中间插入GOTO,不然会引起异议,然后就会出问题,最好是从完整的块中插入。
还有,最好不要使用iostream.h,因为移植性不高,.h的文件不是标准c++的头文件了。现在兼容只是为了方便,标准的stl里面没有那东西了噢。goto最好也不要使用,因为不好理解,呵呵
lable_1:
printf("好了");