多线程
#include <vector>
#include <algorithm>
#include <thread>
#include<numeric>
#include<Windows.h>
using namespace std;
//线程要做的事情就写在这个线程函数中
void GetSumT(char ch)
{
for (int i = 0; i < 100; i++)
{
cout << ch << endl;
Sleep(100);
}
}
int main() //主线程
{
vector<thread*> v;
v.push_back(new thread(GetSumT, 'a'));
v.push_back(new thread(GetSumT, 'b'));
v.push_back(new thread(GetSumT, 'c'));
v.push_back(new thread(GetSumT, 'd'));
v.push_back(new thread(GetSumT, 'e'));
v.push_back(new thread(GetSumT, 'f'));
for (int i = 0; i < v.size(); i++)
{
v[i]->join();
delete v[i];
}
return 0;
}