文件名称:xuhanshu
介绍说明--下载内容均来自于网络,请自行研究使用
利用虚函数手段,按照3种不同的计算方法来求出Fibonacci数列的第n项(的具体项值)并输出。具体地说,可通过在基类baseCla及其派生类fib1Cla、fib2Cla和fib3Cla中说明如下的同一个虚函数“virtual double fib(int n) ”,来实现求Fibonacci数列第n项值并返回的3种不同求解方法。例如,可设计并使用已经在第4和第5章的练习中所实现的求解方法:简单变量“数据平移”法、使用数组的实现法以及使用递归函数的实现法。-The use of virtual function means, in accordance with three kinds of different methods of calculation to find Fibonacci series, the first n items (specific items of value) and the output. Specifically, through the base class baseCla its derived classes fib1Cla, fib2Cla and fib3Cla described in the following virtual function with a " virtual double fib (int n) " , to achieve the first n order to Fibonacci sequence item value and return 3 different solutions are given. For example, can be designed and has been used in section 4 and Chapter 5 of the exercise achieved by solving method: simple variable " data translation" method, using an array implementation of law and the implementation method to use recursive functions.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
3.cpp