摘要: //按值 #include <bits/stdc++.h> using namespace std; int sum(int a){ if(a<=2){ return 1; }else{ return sum(a-1)+sum(a-2); } } int main(){ int x,c,d; cin 阅读全文
posted @ 2023-10-29 09:43 fushuxuan1 阅读(23) 评论(0) 推荐(0)
摘要: //按值传递 #include <bits/stdc++.h> using namespace std; /* 自定义函数必须在调用该函数之前声明 声明时可以不写函数体,但在后面需要将函数体补充完整 按值传递的形参与调用函数类型一致 */ int sum(int a,int b){ int n=a+ 阅读全文
posted @ 2023-10-29 09:13 fushuxuan1 阅读(35) 评论(0) 推荐(0)