Read File into Map

I have to complete the following problem:

Suppose that a file contains the numbers and prices of various products.
Each product number is given on a line by itself. The following line
contains the price of the product. Write code fragments that perform
each of the following:


a) Read the file and store all the prices of the products in a map
indexed by product number.


And I'm not really sure how to go about it. I can open a .txt file but have no idea how to store the file and it's contents into a map. Any help would greatly be appreciated!
First read a line from the file with file >> number >> price;

Then put it into a map with my_map[number] = price;. While insert would be faster, it's not as pretty.
Topic archived. No new replies allowed.