basic input, ouput and stream operations

I have to ahcieve the following :

1) my program gets called with input looking like this : 1549728268___(tab)____4
the numbers are a barcode and the amount of the product linked to the barcode

2) i have to look in an external file to find the product associated with the
barcode and calculate the price.

3) i have to return the amount, the name of the product and the price for all the products + the total price


The following obstacles for me during coding are :

1) the assignement didnt specify the type of the input, so is it integer or
string?

2) how do i take 1 line from a multiple line file and start working with it?

3) how do i compare the barcode from the input to the barcode in the external
file, in other words, how do i search an external file in c++.


I like to think and come up with clever solutions, but in this scenario i think i just need some help to guide me to the right c++ structures i need to use.



input example : 54614645 /t 4 /n
45782145 /t 8 /n
......

output example : 4 /t coca-cola /t 4.00
5 /t tissues /t 5.00
.....

external file example : 854111245 /t tissues /t 1.00
Topic archived. No new replies allowed.