#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<thread>
using namespace std;
int main(){
string str = "渣渣猫";
auto f = [&str]() {
cout << str << endl;
};
f();
cout << endl;
string str1 = "土拨鼠";
auto f1 = [&str1](int a, int b) {
cout << str1 << endl;
cout << "a+b=" << a + b << endl;
};
f1(8, 9);
cout << endl;
string str2 = "锯嘴葫芦";
thread f2 = thread([&str2](int a, int b) {
cout << str2 << endl;
cout << "a+b=" << a + b << endl;
}, 2, 3);
f2.join();
system("pause");
return 0;
}
06-26
468
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)