Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are required to write a C program that uses multithreading to create a guessing game. In this game, parent thread choses a number between

You are required to write a C program that uses multithreading to create a guessing game. In this game, parent thread choses a number between 1 and 10 and child thread guesses that number. Please note the followings:

Parent thread should choose a different number (int) at each run of the program

Parent thread should display the number it has chosen

Parent thread passes that number to the child thread function as a parameter by reference

Child function keeps on guessing the number till it gets it right

When child thread gets the number right, it shows that number with a message (see expected output screenshot) and it straight away exits

Child thread should keep track of number of tries and at each guess, it should display the try number (please refer to the screenshot for more details)

Make sure to differentiate between the messages from child and parent thread (see screenshot below for more details)

Finally, child thread merges into the parent and the program exists.

image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

Students also viewed these Databases questions

Question

10. What is meant by a feed rate?

Answered: 1 week ago