Sorting Vector Elements (P.508)

  1. Modify your previous exercise. After reading the strings into a vector, invoke the sort() function as mentioned in the textbook (P.508) to sort the vector ascendingly. Note that strings are sorted by ASCII-code order, so the result should look like:
    
    Please input file name -- vector1.dat
    
    1:      14
    2:      15
    3:      17
    4:      18
    5:      20
    6:      23
    7:      24
    8:      32
    9:      40
    10:     41
    11:     45
    12:     54
    13:     55
    14:     58
    15:     63
    16:     66
    17:     7
    18:     78
    19:     84
    20:     9