New to C++ Trying to load file into vectors

Hi I am having trouble with a program that I am currently working on. The program is going to read in the names and numbers from a text file and store the numbers in an integer vector and the names in a string vector. I am new to c++ and am having difficulty getting the data to load into the separate vectors.
This is part of the input file:

AIKENS 4800024
MAYHEW 4800108
DISHMAN 4800252
SHICK 4800264
HAIRE 4800480
SIMONSON 4800552
VISSER 4800618
COON 4800768

This input file is sorted by name and the program should also be able to load the vectors from a file sorted by number and unsorted

SMITH 5098872
JOHNSON 4898328
WILLIAMS 5015340
JONES 8381294
BROWN 8362750
DAVIS 4827666
MILLER 4870746

I am confused about how to start this and any help would be greatly appreciated.

I was able to figure this step out so I am now working on the next step. I need to check to see if the input data is sorted by name, number, or is unsorted. I have written some pseudcode to help in the process of creating the function.

1
2
3
4
5
6
7
isSorted( items[0..N-1] )
{
for( i = 0; i < N-1; ++i )
if( items[i] > items[i+1] )
return false
return true
}
Topic archived. No new replies allowed.