Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit 1481514

Browse files
committed
refactor(fib): 重构斐波那契数列示例代码
- 引入 std 命名空间,简化函数调用 - 使用 println 函数替代 std::println,提高代码可读性 - 更新代码格式,确保一致性
1 parent af320f5 commit 1481514

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

fib.cn

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using lib <io>;
2+
using ns std;
23

34
fn fib(n : int) : int{
45
if (n <= 1){
@@ -9,8 +10,8 @@ fn fib(n : int) : int{
910
};
1011

1112
fn main() : int{
12-
std::println("=== 斐波那契数列 ===");
13+
println("=== 斐波那契数列 ===");
1314
result : int = fib(30);
14-
std::println("F(30) = " + result);
15+
println("F(30) = " + result);
1516
return 0;
1617
};

fib.comcn

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)