Menu

Trouble Writing Small Program C Program Program Written C Language Generate Set Integer Ar Q43864374

Having trouble writing this small program:

C Program (program written in C language) should:

– Generate set of integer arrays that are randomly populatedusing command line arguments below (ex. main( intargc, char*argv[]) (note: number of values in each array may bedifferent)
   -q <num> Number of queues (default: 1)
   -r <num> Total number of requests (default: 5)(you can also think of it as number of total # of integers randomlydistributed to each queue. explained in example below)
   -min <num> Minimum integer value (default:0)
   -max <num> Maximum integer value (default:20)

After filling all the queues, the program should print out thesum for each queue and the values in the queue with the lowestsum.

Example, if the command line is program –q 2, the output mightbe:

   Queue 1 sum: 29
   Queue 2 sum: 34
  
   Values in lowest-sum queue:
   14, 5, 10

note: Since -r by default is 5, Queue 1 has 3 integers (we knowit’s queue 1 because lowest-sum equals 29), which means Queue 2only has 2 integers, equaling 5 total integers. Those integers arerandomly distributed. You could end up with queues with no integersand you could end up with all queues having around the same numberof integers. (tip: rand() is one way of randomizing but there areother ways)  

note: Arguments will be a string that needs to be converted(hint: one way is using atoi, but there are other ways)

note: C Program should be able to execute either no “-“arguments, or all four arguments at once, or any combintion ofarguments. This could be done with a switch statement or an if-elsestatement. Don’t worry about odd cases or error checking.

Expert Answer


Answer to Having trouble writing this small program: C Program (program written in C language) should: – Generate set of integer a…

OR