#include<stdexcept>
#include<iostream>
#include<string>
 using namespace std;
 int main()
{
 float fun(float a,float b);
 float a,b,c;
 cout<<"请输入两个实数："<<endl;
 cin>>a>>b;
 try
 {
  c=fun(a,b);
  cout<<"商为："<<c<<endl;
 }
 catch(overflow_error &p)
 {
  cout<<p.what()<<endl; 
 }
 return(0);
}
 float fun(float a,float b)
{
 string s("算术溢出，除数不能为0！");
 float c;
 if(b==0)
  throw overflow_error(s);
 c=a/b;
 return(c);
}