Create a C program that forks itself.  *  * One part will ask the user to enter a number.  * The program will then use a pipe to pass that number to the copy of   * itself that is running.  *  * The copy will then add 1 to the number that it has been passed.  * It will then pass the number back to the original program.  *  * The original program will then print out the number that it has   * received.  *  * Run this program for the following inputs: 500, -1, 7   #include #include #include // Provides definition of "fork" int main(void) {      return 0; }

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 7PP: (Numerical) Using the srand() and rand() C++ library functions, fill an array of 1000 floating-point...
icon
Related questions
Topic Video
Question

 AHPA #13 - The Adding Machine
 *
 * You have decided that what the world needs is a better adding machine   * and gosh darn it, you are going to create it!
 *
 * Create a C program that forks itself.
 *
 * One part will ask the user to enter a number.
 * The program will then use a pipe to pass that number to the copy of 
 * itself that is running.
 *
 * The copy will then add 1 to the number that it has been passed.
 * It will then pass the number back to the original program.
 *
 * The original program will then print out the number that it has 
 * received.
 *
 * Run this program for the following inputs: 500, -1, 7
 

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h> // Provides definition of "fork"


int main(void) {
  
  return 0;
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 6 images

Blurred answer
Knowledge Booster
Instruction Format
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,