Challenge: Sleep in a Multithread Function Call
Complete this hands-on exercise to test your knowledge.
We'll cover the following
Problem statement
Implement the fthread()
function used in a C++ program to manage threads. The function should take an integer n
as input and perform some operations on it, including sleeping for 100 * n
milliseconds and printing some output.
Input
An integer n
where 0 < n <= 10
.
Output
The output should be a string containing the thread number and the current iteration number, formatted as follows: t{n}: {i}
.
Get hands-on with 1400+ tech skills courses.