Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a program that asks for the number of children to create, and two other integer numbers. The program then assigns one arithmetic operation to
Create a program that asks for the number of children to create, and two other
integer numbers. The program then assigns one arithmetic operation to each child
to execute, use only the four basic arithmetic operations, namely:
Addition : Assign this operation to the first child
Subtraction : Assign this operation to the second child
Multiplication : Assign this operation to the third child
Division : Assign this operation to the fourth child
Requirements
Create a function with the name "childCode" for the child process code. This
function doesn't return anything at all void This function must use if statements
to decide which arithmetic operation it needs to execute and print.
For each child make sure it prints its own process id and the result of the assigned
arithmetic operation.
If the user requests less than children, then execute only the operations up to the
number of children requested and end the program.
If the user requests more than children, then execute all the operations and for all
the additional children print this message: "Child with pid#XXXX says: Im a child
with no task!"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started