当前位置:首页 > Software > C++ > 正文内容

函数声明和使用

chanra1n5年前 (2020-10-28)C++6187
C++
#include<iostream>
using namespace std;
int sum(int a,int b);//函数声明 
int main()
{
	cout << sum(1,2);//函数调用 
	return 0;
}
int sum(int a,int b)//函数主体 
{
	return a+b;
}

扫描二维码推送至手机访问。

版权声明:本文由我的FPGA发布,如需转载请注明出处。

本文链接:https://www.myfpga.cn/index.php/post/156.html

“函数声明和使用” 的相关文章

C++的继承和派生

C++的继承和派生

#include <iostream> using namespace std; class fenshu { public: int xuehao; int yuwen;  }; ...

C++入门 输出Hello World

C++入门 输出Hello World

#include <iostream>using namespace std;int main(){     cout << "Hello, world!...

变量作用域

变量作用域

#include<iostream> void print(); int main() { char a=0; for(a=0;a<20;a++) print(); return 0;  }  v...

Break和Continue的区别

Break和Continue的区别

#include<iostream>  using namespace std; int main() { int x=0; for(x=0;x<10;x++) { if(x==3) break;...

C++ 数组的各类性质和用法

C++ 数组的各类性质和用法

#include<iostream>  using namespace std; void addarr(int *k,int len); //文中形如sizeof(x)/sizeof(x[0]) 是用数组占用空...