自定义函数
小吴WZK
编程小白
展开
-
自定义函数2.递归
#include <bits/stdc++.h> using namespace std; int a(int b);//定义函数名 int main() { int i; cin>>i; cout<<a(i)<<endl;//调用函数 return 0; } int a(int b) { if(b==1) return 1; else return b*a(b-1);//计算b*...原创 2021-11-21 11:56:00 · 484 阅读 · 0 评论 -
自定义函数1.
#include <bits/stdc++.h> using namespace std; int a(int b,int c);//定义函数名 int main() { int i,j; cin>>i>>j; cout<<a(i,j)<<endl;//引用函数 return 0; } int a(int b,int c) { int d; d=pow(b,c);//计算b的c次方 retur...原创 2021-11-20 17:48:02 · 199 阅读 · 0 评论 -
自定义函数1,如何自定义。
#include <bits/stdc++.h> using namespace std; int a(int b,int c);//定义函数名 int main() { int i,j; cin>>i>>j; cout<<a(i,j)<<endl;//引用函数 return 0; } int a(int b,int c) { int d; d=pow(b,c);//pow(x,y)的意思是x的y次方...原创 2021-11-24 15:41:36 · 412 阅读 · 0 评论