Hi I would like to ask if anyone knows how to solve the problem.

How do I get a certain row like row 3 column 4 value from the .txt file to minus away another value like from row 8 column 4 from the same .txt file.

For example, I would like to get a value from every fifth row to minus the value from the first row.

#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;

int main ()

double num;
double hi;
double go;
int l,h,t;
string line;
ifstream myfile ("hi.txt");

if (myfile.is_open())
while( myfile.good() )
getline (myfile,line);
stringstream convert(line);
if ( !(convert >> num) ){

cout << num << endl;


else cout << "Unable to open file";
return 0;
Topic archived. No new replies allowed.