C++
Jason_351
这个作者很懒,什么都没留下…
展开
-
找出数组中第二大值
找出数组中的第二大值。C++实现源码:#include#include#includeusing namespace std;static const int MaxArray = 20;int SecondValue(int a[], int n, int &Second){ if(n < 2){ return -1; } int原创 2013-07-30 16:24:19 · 760 阅读 · 0 评论 -
mutable关键字
C++中用const修饰的函数不能改变对象中的非静态成员的值。如果成员变量加了mutable修改字后,则可以在const修饰的函数中修改对象的成员值.原创 2013-07-25 22:39:37 · 385 阅读 · 0 评论 -
求平方根的方法(牛顿迭代法和二分法)
#include #include #include using namespace std;double _sqrt(double val, double x) //牛顿迭代法{ if(abs(x*x - val) else{ x = (x + val/x)/2; return _sqrt(val原创 2013-09-17 11:00:32 · 924 阅读 · 0 评论