#inclue<iosteam>
using namespace std;
//函数常见样式
// 1、无参无返回值
void test01(){
cout<<"this is test01" << endl;
}
// 2 、有参无返回值
void test02(int a){
cout << "this is test02 a =" << a <<endl;
}
// 无参数有返回值
int (){
cout << "this is test03"<<endl;
return 1000;
}
//有参数有返回值
int test04 (int a){
cout << "this is test04 a =" << a <<endl;
retrurn 1000;
}
int main(){
//无参无返函数调用
test01();
//有参无返回函数调用
test02(100);
//无参有返回值函数的调用
int num1 = test03();
cout << "num1" << num1 <<endl;
//有参数有返回值的调用
int num2 = test04(10000);
cout << "num2 = "<< num2 <<endl;
}
函数的常见样式
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 单体: var ton = { name:'tom', age:18, showName:functionn(){...
- Android中自定义样式与View的构造函数中的第三个参数defStyle的意义 零、序 一、自定义Style ...
- 相信小伙伴们都遇到过这样的问题,明明家里网速很快,在百度网盘下载东西却很慢!!! 这是我的第一篇文章,以后也会多多...