Need some to gve me a solution code to this: commander interpreter

Write a special simple command interpreter that takes command(s) and its(their) arguments. This special command interpreter will only have three different cases that need to be addresses in your interpreter program.

1. If it is a single command, the main process creates a child process to execute the command using exec() family functions. After executing the command, it asks for new command input. (parent wait for child)

2. If it is a single command and it is to be executed in background, (that is, the command line has a & symbol at end) the interpreter wont wait for its child.

3. If the command is a multiple background command, (eg. cd lab5 &; ls &) [that is if the background commands are separated by the symbol ; ] then the interpreter creates a number of child processes, equal to the number of commands and executes one after the other in the same order as appear in the command line. Each child process will execute one command using exec family of functions. (parent will not wait for any child. Make sure the first command child process finishes first and then the second starts)

Question 2:
There are x number of sections in a course. In each section y number of quizzes are conducted. The average for each quiz in all the sections need to be found out. To solve this, write program which has the main process as Director process, which reads a file containing marks of all quizzes of all sections and creates x number of Manager processes. Each Manager process will take care of solving for a section. Each manager process will create y number of worker process and pass one quiz to each of them and they calculate and print the average.

Read x and y as input from the user. All quizzes are graded out of 20 points. Assume the number of students in all the sections is same and it is 10 per section. The input file should contain the data according to the value of x and y.

The input text file will look like the following: [for x=2 and y=2]
Don't post homework questions
Those questions are for you to work out, so that you will learn from the experience. It is OK to ask for hints, but not for entire solutions.
Pls I ask for hints as a beginner in C++. Thanks keskiverto
Topic archived. No new replies allowed.