Lambda functions in C++

Example 1:

#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <thread>
#include <array>
#include <functional>
#include <iostream>
#include <string_view>
using namespace std;

void example_1()
{
std::array<int, 10> s {5, 7, 4, 2, 8, 6, 1, 9, 0, 3}; 
vector<int> vz = {4,2,81,5,1,0,6}; 

auto add_print = [&s,&vz]() //lambda-1
{
cout<<"array: ";for (auto& a : s) {a++;std::cout << a << ",";}
cout<<"\nvector: ";for (auto& a : vz) {a++;std::cout << a << ",";}
cout<<'\n';
};

auto print = [&s,&vz]()     //lambda-2
{
cout<<"array: ";for (auto a : s) {std::cout << a << ",";}
cout<<"\nvector: ";for (auto a : vz) {std::cout << a << ",";}
};


add_print();
print();
}

void example_2()
{
    vector<int> v = {4,2,81,5,1,0,6};
    sort(v.begin(),v.end(),[](int a, int b) //lambda
    {
        return a > b;
    }
    );

    for(auto a: v) {cout<<a<<'-';} //print
}

int main()
{

example_1();

example_2();

}