读书人

关于错误处理C+小疑点

发布时间: 2012-03-14 12:01:13 作者: rapoo

在线等关于异常处理C+小问题
#include<iostream>
using namespace std;

void main(int argc,char*argv[])
{




try

{
int a,b;
cout<<"please input a num:";
cin>>a>>endl;
cout<<"please input again:";
cin>>b>>endl;
if(b==0) throw b;
cout<<"a/b="<<a/b<<endl;
}




catch(int)
{
cout<<"除数为0"<<endl;
}
}





错误:error C2679: binary '>>' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion)
么子意思 怎么修改啊?

[解决办法]

C/C++ code
cin>>a>>endl;去掉endl  cin>>a; cin是输入流,不需要endl。
[解决办法]
探讨

C/C++ code

cin>>a>>endl;去掉endl cin>>a; cin是输入流,不需要endl。

读书人网 >C++

热点推荐