代码:
#include <iostream>
#include <cmath>
#include <cstdlib>
using namespace std;
int main()
{
int n;
cout<<"输入要开方的数:";
cin>>n;
try
{
if(n<0)
throw n;
}
catch(int)
{
cout<<"负数还想开方??"<<endl;
exit(0);
}
cout<<"√ ̄"<<n<<"="<<sqrt(n)<<endl;
return 0;
}
结果:
小结:
到期末了,挺快的。
老师也比较体谅我们把,也可能是这边的内容没啥好出的项目,我大概一看项目好像都很短而且很简单。
但是真正一做发现知道的其实很片面,认真把这周的做完吧
加油~