Shortest Job First:
In operating systems, tasks that are queued to be processed go through different scheduling algorithms in different operating systems. Shortest Job First or SJF is one of them. In shortest job first, literary, the smallest task among all the remaining tasks will get processed first.
However, I explained Shortest Job First (SJF) in my another post earlier and as many of my readers wanted to have the source code, here I am publishing the source code of the program. I am not currently explaining the source code, please try to play with it to understand it. I am removing comments intentionally.
Following is a screenshot of the program with input and output.
I hope that you can now study and experiment the source code to write yours and that would be much better, more efficient and strict than this one.