How to read specific numbers from .txt

Basically I am trying to do calculations with numbers from a txt file.
4
32 8
38 6
38 6
16 7

However I dont know how to select a number specifically and then use it in a calculation. I have already fin the the file, i just need to know how to do 32+7 for example. I know how to do equations via coding however I dont know how to pick specific numbers to use in the equation. please help :)
When you have read the file, have you stored each separate number from the file in a separate int or to some int array/vector?
1
2
3
4
5
6
int array n[9], sum = 0; //A std::vector might be better. Do you know them? 
//Read from file to the array. Is this what you need help with? 


sum = n[0] + n[1]; //Would be 4 + 32 if we use your example numbers. 
sum = n[1] + n[8]; //Would be 32 + 7  
Topic archived. No new replies allowed.