We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3253c06 commit ff85a2fCopy full SHA for ff85a2f
exercises/05_constexpr/main.cpp
@@ -1,6 +1,6 @@
1
#include "../exercise.h"
2
3
-constexpr int fibonacci(int i) {
+constexpr unsigned long long fibonacci(int i) {
4
switch (i) {
5
case 0:
6
return 0;
@@ -13,10 +13,11 @@ constexpr int fibonacci(int i) {
13
14
int main(int argc, char **argv) {
15
constexpr auto FIB20 = fibonacci(20);
16
+ ASSERT(FIB20 == 6765, "fibonacci(20) should be 6765");
17
std::cout << "fibonacci(20) = " << FIB20 << std::endl;
18
19
// TODO: 观察错误信息,修改一处,使代码编译运行
- constexpr auto ANS_N = 30;
20
+ constexpr auto ANS_N = 100;
21
constexpr auto ANS = fibonacci(ANS_N);
22
std::cout << "fibonacci(" << ANS_N << ") = " << ANS << std::endl;
23
0 commit comments