Question: 1. (100 points) Create multiple threads to do tasks simultaneously. Read the C++ thread class introduction at https://en.cppreference.com/w/cpp/thread/thread then run the following code. //Example #include


1. (100 points) Create multiple threads to do tasks simultaneously. Read the C++ thread class introduction at https://en.cppreference.com/w/cpp/thread/thread then run the following code. //Example \#include \#include \#include using namespace std; // The function we want to execute on the new thread. void task1(string msg) \{ \} seut "task1 says: " msg; int main( ) \{ // Constructs the new thread and runs it. Does not block execution. thread t1(task1, "Hello"); // Do other things... // Makes the main thread wait for the new thread to finish execution, therefore blocks its own execution. t, join (; return ; \} (40 points) modify the example code and create two threads. One thread is to calculate the sum of integers from 1 to 10 and other thread is to calculate the factorial 10!. Display the results on screen. Source code and screenshot of running results are shown below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
