当前位置: 首页> 科技> 数码 > 动态网页设计实例_拔萝卜视频播放在线观看免费_青岛做网站推广公司_手机网站排名优化软件

动态网页设计实例_拔萝卜视频播放在线观看免费_青岛做网站推广公司_手机网站排名优化软件

时间:2025/7/13 4:03:24来源:https://blog.csdn.net/m0_68142120/article/details/143808805 浏览次数:0次
动态网页设计实例_拔萝卜视频播放在线观看免费_青岛做网站推广公司_手机网站排名优化软件

#define _CRT_SECURE_NO_WARNINGS h
#include<iostream>
#include<algorithm>
using namespace std;

//class Person
//{
//public:
//
//    //Person() = delete;
//    Person(Person&& p) = delete;
//private:
//    string _name;
//    int _age;
//};
//
//int main()
//{
//    Person p1;
//    Person p2=p1;
//    Person p3=move(p1);
//
//    return 0;
//}
//class animal
//{
//public:
//    virtual void say() 
//    {
//        cout << "各种各样的声音" << endl;
//    }
//};
//
//class dog :public animal
//{
//public:
//    virtual void say() override
//    {
//        cout << "芝士小狗" << endl;
//    }
//};

#include<functional>

int sub(int a, int b)
{
    return a - b;
}

int threesub(int a,int b,int c)
{
    return a - b - c;
}

struct Functor
{
public:
    int operator() (int a, int b)
    {
        return a + b;
    }
};


class Plus
{
public:
    Plus(int n = 10)
        :_n(n)
    {}
    static int plusi(int a, int b)
    {
        return a + b;
    }
    double plusd(double a, double b)
    {
        return (a + b) * _n;
    }
private:
    int _n;
};
void Print()
{
    cout << "hello world" << endl;
}

using placeholders::_1;
using placeholders::_2;
using placeholders::_3;

int main()
{
    //auto b1 = bind(sub, _1, _2);
    //cout << b1(3, 1) << endl;
    bind本质上返回一个仿函数对象
     调整参数顺序0
     _1代表第一个实参
     _2代表第二个实参
    //auto b2 = bind(sub, _2, _1);
    //cout << b2(3, 1) << endl;

    //auto b3 = bind(sub, 100, _1);
    //cout << b3(10) << endl;

    //auto b4 = bind(sub, _1, 100);
    //cout << b4(10) << endl;

    //auto b5 = bind(threesub, _1, _2, 100);
    //cout << b5(5, 1) << endl;

    //auto b6 = bind(threesub,100, _1, _2);
    //cout << b6(5, 1) << endl;

    //auto b7 = bind(threesub, _1, 100, _2);
    //cout << b7(5, 1) << endl;

    成员函数对象进行绑死,就不需要每次都传递了
    //function<double(Plus&&, double, double)> ff1 = &Plus::plusd;
    //Plus p;
    //cout << ff1(move(p), 1.1, 1.1) << endl;
    //cout << ff1(Plus(), 1.1, 1.1) << endl;

    //function<double(double, double)> ff2 = bind(&Plus::plusd, Plus(), _1, _2);
    //cout << ff2(1.1, 1.1) << endl;

    auto func1 = [](double rate, double money, int year) {
        double ret = money;
        for (int i = 0; i < year; i++)
        {
            ret += ret * rate;
        }
        return ret - money;
        };
    // 绑死⼀些参数,实现出⽀持不同年华利率,不同⾦额和不同年份计算出复利的结算利息 
    function<double(double)> func3_1_5 = bind(func1, 0.015, _1, 3);
    function<double(double)> func5_1_5 = bind(func1, 0.015, _1, 5);
    function<double(double)> func10_2_5 = bind(func1, 0.025, _1, 10);
    function<double(double)> func20_3_5 = bind(func1, 0.035, _1, 30);
    cout << func3_1_5(1000000) << endl;
    cout << func5_1_5(1000000) << endl;
    cout << func10_2_5(1000000) << endl;
    cout << func20_3_5(1000000) << endl;
}

//int main()
//{
//    //function<int(int, int)> f1 = add;
//    //function<int(int, int)> f2 = Functor();
//    //function<int(int, int)> f3 = [](int a, int b) {return a + b; };
//    //function<void()> f4 = Print;
//    //f4();
//
//    //cout << f1(1, 1)<<endl;
//    //cout << f2(1, 1)<<endl;
//    //cout << f3(1, 1)<<endl;
//
//    //包装静态成员函数
//    //成员函数要指定类域并且前面加&才能获取地址
//    function<int(int, int)> f5 = &Plus::plusi;
//    cout << f5(1, 1) << endl;
//
//    //包装不同成员函数
//    //普通成员函数还有一个隐含的this指针参数,所以绑定时传对象或者对象的指针过去都可以
//    Plus p;
//    function<double(Plus*, double, double)> f6 = &Plus::plusd;
//    cout << f6(&p, 2.2, 2.2) << endl;
//
//    function<double(Plus, double, double)> f7 = &Plus::plusd;
//    cout << f7(p, 2.2, 2.2) << endl;
//
//    function<double(Plus&&, double, double)> f8 = &Plus::plusd;
//    cout << f8(move(p), 2.2, 2.2) << endl;
//
//    return 0;
//}

#define _CRT_SECURE_NO_WARNINGS h
#include<iostream>
#include<algorithm>
using namespace std;

//class Person
//{
//public:
//
//    //Person() = delete;
//    Person(Person&& p) = delete;
//private:
//    string _name;
//    int _age;
//};
//
//int main()
//{
//    Person p1;
//    Person p2=p1;
//    Person p3=move(p1);
//
//    return 0;
//}
//class animal
//{
//public:
//    virtual void say() 
//    {
//        cout << "各种各样的声音" << endl;
//    }
//};
//
//class dog :public animal
//{
//public:
//    virtual void say() override
//    {
//        cout << "芝士小狗" << endl;
//    }
//};

#include<functional>

int sub(int a, int b)
{
    return a - b;
}

int threesub(int a,int b,int c)
{
    return a - b - c;
}

struct Functor
{
public:
    int operator() (int a, int b)
    {
        return a + b;
    }
};


class Plus
{
public:
    Plus(int n = 10)
        :_n(n)
    {}
    static int plusi(int a, int b)
    {
        return a + b;
    }
    double plusd(double a, double b)
    {
        return (a + b) * _n;
    }
private:
    int _n;
};
void Print()
{
    cout << "hello world" << endl;
}

using placeholders::_1;
using placeholders::_2;
using placeholders::_3;

int main()
{
    //auto b1 = bind(sub, _1, _2);
    //cout << b1(3, 1) << endl;
    bind本质上返回一个仿函数对象
     调整参数顺序0
     _1代表第一个实参
     _2代表第二个实参
    //auto b2 = bind(sub, _2, _1);
    //cout << b2(3, 1) << endl;

    //auto b3 = bind(sub, 100, _1);
    //cout << b3(10) << endl;

    //auto b4 = bind(sub, _1, 100);
    //cout << b4(10) << endl;

    //auto b5 = bind(threesub, _1, _2, 100);
    //cout << b5(5, 1) << endl;

    //auto b6 = bind(threesub,100, _1, _2);
    //cout << b6(5, 1) << endl;

    //auto b7 = bind(threesub, _1, 100, _2);
    //cout << b7(5, 1) << endl;

    成员函数对象进行绑死,就不需要每次都传递了
    //function<double(Plus&&, double, double)> ff1 = &Plus::plusd;
    //Plus p;
    //cout << ff1(move(p), 1.1, 1.1) << endl;
    //cout << ff1(Plus(), 1.1, 1.1) << endl;

    //function<double(double, double)> ff2 = bind(&Plus::plusd, Plus(), _1, _2);
    //cout << ff2(1.1, 1.1) << endl;

    auto func1 = [](double rate, double money, int year) {
        double ret = money;
        for (int i = 0; i < year; i++)
        {
            ret += ret * rate;
        }
        return ret - money;
        };
    // 绑死⼀些参数,实现出⽀持不同年华利率,不同⾦额和不同年份计算出复利的结算利息 
    function<double(double)> func3_1_5 = bind(func1, 0.015, _1, 3);
    function<double(double)> func5_1_5 = bind(func1, 0.015, _1, 5);
    function<double(double)> func10_2_5 = bind(func1, 0.025, _1, 10);
    function<double(double)> func20_3_5 = bind(func1, 0.035, _1, 30);
    cout << func3_1_5(1000000) << endl;
    cout << func5_1_5(1000000) << endl;
    cout << func10_2_5(1000000) << endl;
    cout << func20_3_5(1000000) << endl;
}

//int main()
//{
//    //function<int(int, int)> f1 = add;
//    //function<int(int, int)> f2 = Functor();
//    //function<int(int, int)> f3 = [](int a, int b) {return a + b; };
//    //function<void()> f4 = Print;
//    //f4();
//
//    //cout << f1(1, 1)<<endl;
//    //cout << f2(1, 1)<<endl;
//    //cout << f3(1, 1)<<endl;
//
//    //包装静态成员函数
//    //成员函数要指定类域并且前面加&才能获取地址
//    function<int(int, int)> f5 = &Plus::plusi;
//    cout << f5(1, 1) << endl;
//
//    //包装不同成员函数
//    //普通成员函数还有一个隐含的this指针参数,所以绑定时传对象或者对象的指针过去都可以
//    Plus p;
//    function<double(Plus*, double, double)> f6 = &Plus::plusd;
//    cout << f6(&p, 2.2, 2.2) << endl;
//
//    function<double(Plus, double, double)> f7 = &Plus::plusd;
//    cout << f7(p, 2.2, 2.2) << endl;
//
//    function<double(Plus&&, double, double)> f8 = &Plus::plusd;
//    cout << f8(move(p), 2.2, 2.2) << endl;
//
//    return 0;
//}

#define _CRT_SECURE_NO_WARNINGS h
#include<iostream>
#include<algorithm>
using namespace std;

//class Person
//{
//public:
//
//    //Person() = delete;
//    Person(Person&& p) = delete;
//private:
//    string _name;
//    int _age;
//};
//
//int main()
//{
//    Person p1;
//    Person p2=p1;
//    Person p3=move(p1);
//
//    return 0;
//}
//class animal
//{
//public:
//    virtual void say() 
//    {
//        cout << "各种各样的声音" << endl;
//    }
//};
//
//class dog :public animal
//{
//public:
//    virtual void say() override
//    {
//        cout << "芝士小狗" << endl;
//    }
//};

#include<functional>

int sub(int a, int b)
{
    return a - b;
}

int threesub(int a,int b,int c)
{
    return a - b - c;
}

struct Functor
{
public:
    int operator() (int a, int b)
    {
        return a + b;
    }
};


class Plus
{
public:
    Plus(int n = 10)
        :_n(n)
    {}
    static int plusi(int a, int b)
    {
        return a + b;
    }
    double plusd(double a, double b)
    {
        return (a + b) * _n;
    }
private:
    int _n;
};
void Print()
{
    cout << "hello world" << endl;
}

using placeholders::_1;
using placeholders::_2;
using placeholders::_3;

int main()
{
    //auto b1 = bind(sub, _1, _2);
    //cout << b1(3, 1) << endl;
    bind本质上返回一个仿函数对象
     调整参数顺序0
     _1代表第一个实参
     _2代表第二个实参
    //auto b2 = bind(sub, _2, _1);
    //cout << b2(3, 1) << endl;

    //auto b3 = bind(sub, 100, _1);
    //cout << b3(10) << endl;

    //auto b4 = bind(sub, _1, 100);
    //cout << b4(10) << endl;

    //auto b5 = bind(threesub, _1, _2, 100);
    //cout << b5(5, 1) << endl;

    //auto b6 = bind(threesub,100, _1, _2);
    //cout << b6(5, 1) << endl;

    //auto b7 = bind(threesub, _1, 100, _2);
    //cout << b7(5, 1) << endl;

    成员函数对象进行绑死,就不需要每次都传递了
    //function<double(Plus&&, double, double)> ff1 = &Plus::plusd;
    //Plus p;
    //cout << ff1(move(p), 1.1, 1.1) << endl;
    //cout << ff1(Plus(), 1.1, 1.1) << endl;

    //function<double(double, double)> ff2 = bind(&Plus::plusd, Plus(), _1, _2);
    //cout << ff2(1.1, 1.1) << endl;

    auto func1 = [](double rate, double money, int year) {
        double ret = money;
        for (int i = 0; i < year; i++)
        {
            ret += ret * rate;
        }
        return ret - money;
        };
    // 绑死⼀些参数,实现出⽀持不同年华利率,不同⾦额和不同年份计算出复利的结算利息 
    function<double(double)> func3_1_5 = bind(func1, 0.015, _1, 3);
    function<double(double)> func5_1_5 = bind(func1, 0.015, _1, 5);
    function<double(double)> func10_2_5 = bind(func1, 0.025, _1, 10);
    function<double(double)> func20_3_5 = bind(func1, 0.035, _1, 30);
    cout << func3_1_5(1000000) << endl;
    cout << func5_1_5(1000000) << endl;
    cout << func10_2_5(1000000) << endl;
    cout << func20_3_5(1000000) << endl;
}

//int main()
//{
//    //function<int(int, int)> f1 = add;
//    //function<int(int, int)> f2 = Functor();
//    //function<int(int, int)> f3 = [](int a, int b) {return a + b; };
//    //function<void()> f4 = Print;
//    //f4();
//
//    //cout << f1(1, 1)<<endl;
//    //cout << f2(1, 1)<<endl;
//    //cout << f3(1, 1)<<endl;
//
//    //包装静态成员函数
//    //成员函数要指定类域并且前面加&才能获取地址
//    function<int(int, int)> f5 = &Plus::plusi;
//    cout << f5(1, 1) << endl;
//
//    //包装不同成员函数
//    //普通成员函数还有一个隐含的this指针参数,所以绑定时传对象或者对象的指针过去都可以
//    Plus p;
//    function<double(Plus*, double, double)> f6 = &Plus::plusd;
//    cout << f6(&p, 2.2, 2.2) << endl;
//
//    function<double(Plus, double, double)> f7 = &Plus::plusd;
//    cout << f7(p, 2.2, 2.2) << endl;
//
//    function<double(Plus&&, double, double)> f8 = &Plus::plusd;
//    cout << f8(move(p), 2.2, 2.2) << endl;
//
//    return 0;
//}

关键字:动态网页设计实例_拔萝卜视频播放在线观看免费_青岛做网站推广公司_手机网站排名优化软件

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: