I need to know whether in c++ we can read values from a .txt file and use it to calculate something.

EXAMPLE:-
In the TEXT FILE-
FoodCode: f2,f3,g2
where anything of type 'f' is 50bucks and of type 'g' is 100bucks.
&
By using a C++ Program i want to calculate the overall cost of the order.
Like adding f2+f3+g2=50+50+100
and finally Output=200bucks;
The program should read only the 2nd line(coz thats where the food codes are entered)
Pls respond as soon as possible.
Thank You