c program to display first 10 largest numbers present in a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lakshmanag
    New Member
    • Oct 2012
    • 1

    c program to display first 10 largest numbers present in a file

    there is a file contains only a numbers ,we dont know how many numbers present in that file.so i want a program to display top n largest number present in that fie.(n may be 5,10,12 like that.)
  • Meetee
    Recognized Expert Contributor
    • Dec 2006
    • 928

    #2
    You will have to compare every number with the earlier number and put the largest and smallest in two variables, run this loop till the end of file.

    Comment

    • nextstep
      New Member
      • Aug 2012
      • 14

      #3
      it is similar to sort algorithm. you could take a look to them for more reference. i think that you can reuse some code after

      Comment

      • sgayathri2412
        New Member
        • Oct 2012
        • 8

        #4
        go on for quick sort or bubble sort algorithms but if there are too many datas,then go for merge sort

        Comment

        Working...