c02p062.txt

来自「Data Abstraction & Problem Solving with 」· 文本 代码 · 共 11 行

TXT
11
字号
int fact(int n)// Precondition: n must be greater than or equal to 0.// Postcondition: Returns the factorial of n.{   if (n == 0)      return 1;   else  // Invariant: n > 0, so n-1 >= 0.         // Thus, fact(n-1) returns (n-1)!      return n * fact(n-1);  // n * (n-1)! is n!}  // end fact

⌨️ 快捷键说明

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