By Thanos Stantzouris
Choose your prefered Language: greek_flag uk_flag

The production of a product requires N process stages from M different machines (N = known, M = known). Each machine can be used more than once for the same product.
For production stage it is known:

  1. The processing stage code ( integer number in range [1-999] )
  2. Machine tool code used ( integer number in area [1-9] )
  3. The stage time, in sec ( integer> 0 )

Write a C language program that will implement the following:

  1. It will enter data in an array of integers with 3 * N number of positions, based on the N from above. (If the scanf_s command is used, it is necessary to check the validity of values.) It is recommended to use the rand () function properly to avoid the value validity check process.)
  2. Considering that the order of execution of the processing stages in each machine is determined by the code of the processing stage, with priority low to high :
  • Find and display the order of execution of the machining stages on each machine, WITHOUT USING SORTING PROCEDURES! At the same time calculate and display the total working time of each machine process.

Numerical EXAMPLE, N = 8.
The used machine tools (M = 4) are: 2, 5, 7, 9.
 

157 2 45 19 7 10 14 9 77 91 2 120 305 2 17 72 5 71 345 7 5 773 5 88


Results :
MACHINE: 2 | 91, 157, 305        total time: 182
MACHINE: 5 | 72, 773                total time: 159
MACHINE: 7 | 19, 345                total time: 15
MACHINE: 9 | 14                        total time: 77