首页 > 其他 > 详细

052.函数-函数常见样式

时间:2021-09-05 16:05:26      阅读:21      评论:0      收藏:0      [点我收藏+]
#include <iostream>
using namespace std;

//函数常见样式
//1.无参无返
void test01()
{
    cout << "test01" << endl;
}

//2.有参无返
void test02(int a)
{
    cout << "test02" << a << endl;
}

//3.无参有返
int test03()
{
    cout << "test03" << endl;
    return 100;
}

//4.有参有返
int test04(int a)
{
    cout << "test04" << endl;
    return a;
}

int main()
{
    //1.无参无返
    test01();

    //2.有参无返
    test02(2);

    //3.无参有返
    int a = test03();

    //4.有参有返
    int b = 1000;
    int c = test04(b);

    system("pause");
    return 0;
}

 

052.函数-函数常见样式

原文:https://www.cnblogs.com/ceovs/p/15226439.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!