vc++中try,catch,throw怎么不对了?我写了这样的代码 try {if(this->textBox1 ->Text ==" "||this->textBox2 ->Text ==" ") throw "a";}catch (char ){this->label4->Text ="数据输入错误";};int a,b,c;a=Convert::ToInt32 (this->textBox1->Text );

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/11 22:31:19
vc++中try,catch,throw怎么不对了?我写了这样的代码 try {if(this->textBox1 ->Text ==textBox2 ->Text ==" ") throw "a";}catch (char ){this->label4->Text ="数据输入错误";};int a,b,c;a=Convert::ToInt32 (this->textBox1->Text );" />

vc++中try,catch,throw怎么不对了?我写了这样的代码 try {if(this->textBox1 ->Text ==" "||this->textBox2 ->Text ==" ") throw "a";}catch (char ){this->label4->Text ="数据输入错误";};int a,b,c;a=Convert::ToInt32 (this->textBox1->Text );
vc++中try,catch,throw怎么不对了?
我写了这样的代码
try {if(this->textBox1 ->Text ==" "||this->textBox2 ->Text ==" ") throw "a";}
catch (char ){this->label4->Text ="数据输入错误";};
int a,b,c;
a=Convert::ToInt32 (this->textBox1->Text );
b=Convert::ToInt32 (this->textBox2->Text) ;
c=a+b;
for(c=1;c%b!=0||c%a!=0;c++);
this->label4->Text =this->textBox1 ->Text +"和"+this->textBox2 ->Text +"的最小公倍数是:"+ Convert::ToString (c);
在编译时可以通过,但是输入空格时,它不能正确处理异常啊,这是为什么啊?
不要只是评价啊,要的是解决的办法,就是不懂才问啊

vc++中try,catch,throw怎么不对了?我写了这样的代码 try {if(this->textBox1 ->Text ==" "||this->textBox2 ->Text ==" ") throw "a";}catch (char ){this->label4->Text ="数据输入错误";};int a,b,c;a=Convert::ToInt32 (this->textBox1->Text );
try
{
if(!strcmp(" ",this->textBox1 ->Text)
|| !strcmp(" ",this->textBox2 ->Text))
throw "a";
}
catch (char* )
{
this->label4->Text ="数据输入错误";
AfxMessageBox("数据输入错误");
};
补充:
请问一下 silvergingko 我给的答案对不对啊

C#在try中包含throw交给哪个catch处理 关于c++ 中使用try throw catch语句例如,.int a;try{cin a;throw a;}catch (int){cout vc++中try,catch,throw怎么不对了?我写了这样的代码 try {if(this->textBox1 ->Text == ||this->textBox2 ->Text == ) throw a;}catch (char ){this->label4->Text =数据输入错误;};int a,b,c;a=Convert::ToInt32 (this->textBox1->Text ); try catch必须和throw连用吗 哪位朋友告诉我C++里try,catch,throw的用法 关于try catch语句的问题catch{throw;}这里的catch是捕获所有异常吧?“在 catch 块中可以使用 throw 语句再次引发已由 catch 语句捕获的异常”这句话是什么意思?为什么要再次引发呢?有什么用? 使用try.catch和throw语句实现求解实系数一元二次方程的实数根 c# throw的用法c#中throw到底是干什么用的,它是捕获异常,然后弹出异常对话框吗?像MessageBox.Show一样吗?它可以和try,catch连在一起使用吗?如下例:if (e.ClickedItem == print){i = 0;try{if (((Form2)ActiveMdiChild) 若catch中抛出运行时异常,请问在try catch语句块中return语句是写在try中还是写在try catch语句外. java中catch(EOFException e){ try{ in.close();}什么意思? 如果throw函数抛出多个同类型参量,如何用catch函数捕捉?例如:if(……)throw“error1”; else if (……) throw“error2”;else throw“error3”;try(……){ // };catch(char *){ } catch 函数体如何写才能分 try-catch用法 try catch的作用 在java语言中try-catch的catch中能否再加try--catch?例如:try{//code}catch(Exception e){ //在这个catch中能否再加个try-catch try{//code}catch(Exception e){//code}//code}希望大神能回答的详细点, 7.( )语句用来标示一个成员函数可能抛出的各种异常 A、try和catch B、finally C、throw D、throws What can you catch but not throw? try catch里面可以套try catch吗 关于JAVA t中try-catch的用法?一个try-catch块 是不是只能 捕获一个错误呀?多重的try-catch(一个try中有N个catch)是能捕获多种错误还是捕获多个错误?具体说一下,书上都把我弄晕了 ,了还有嵌套的try-ca