Converting a String to an Integer

  1. Modify your previous exercise for sorting vector elements. This time, after reading a string of digits, we want to convert it into an integer, and store these numbers in an integer vector.
  2. To convert a character array to an integer, you may use the atoi() function.
  3. The sorting result should look like this:
    
    Please input file name -- vector1.dat
    
    1:      7
    2:      9
    3:      14
    4:      15
    5:      17
    6:      18
    7:      20
    8:      23
    9:      24
    10:     32
    11:     40
    12:     41
    13:     45
    14:     54
    15:     55
    16:     58
    17:     63
    18:     66
    19:     78
    20:     84