首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

关于错误处理C+小疑点

2012-03-14 
在线等关于异常处理C+小问题#includeiostreamusing namespace stdvoid main(int argc,char*argv[]){try

在线等关于异常处理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。

热点排行