⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sl_ex.cpp

📁 非常好用的用C编写的矩阵类,可在不同编译器下编译使用.
💻 CPP
字号:
/// \ingroup newmat
///@{

/// \file sl_ex.cpp
/// Test one-dimensional solve function.
/// This is an example of the use of solution to find the cube root of 
/// the integers -10 to 10
///
/// you will need to compile and link solution.cpp and my_except.cpp

#define WANT_STREAM
#define WANT_MATH

#include "include.h"
#include "solution.h"

#ifdef use_namespace
using namespace RBD_LIBRARIES;
#endif


// the cube class

class Cube : public R1_R1
{ Real operator()() { return x*x*x; } };


int my_main()
{
   // construct the Cube object
   Cube cube;
   // and then the solve object
   OneDimSolve cube_root(cube);
   // Now do the solves
   for (int i=-10; i<=10; i++)
      cout << i << "   "  << cube_root.Solve(i,0,1.5) << endl;
   return 0;
}

// call my_main() - use this to catch exceptions
int main()
{
   Try
   {
      return my_main();
   }
   Catch(BaseException)
   {
      cout << BaseException::what() << "\n";
   }
   CatchAll
   {
      cout << "\nProgram fails - exception generated\n\n"; 
   }
   return 0;
}


///@}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -