Answered step by step
Verified Expert Solution
Link Copied!

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 (10+5=15) : Assign this operation to the first child
Subtraction (10-5=5) : Assign this operation to the second child
Multiplication (10**5=50): Assign this operation to the third child
Division (10/5=2) : 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 4 children, then execute only the operations up to the
number of children requested and end the program.
If the user requests more than 4 children, then execute all the operations and for all
the additional children print this message: "Child with pid#XXXX says: I'm a child
with no task!"
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

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions