I'm glad that was useful.
I didn't know what sort of data was in the input file, I just saw you had an array of strings.
If you want to do any sort of calculations with the string, it needs to first be converted into a numeric type, such as
There are several different ways to do that. You could use the functions
The code might be something like this:
double n = atof(str[ix].c_str());
Note the use of
to convert the C++ string to a plain character string.
You might instead use a stringstream.
ss >> d;
I find stringstream very useful, it's worth becoming familiar with. http://www.cplusplus.com/reference/sstream/
Note - if all of the data in the text file consists of numbers, then you should probably not be using an array of strings to handle them. Right from the start, read and store each value as a number. (But if you have a mixture of strings and numbers, then there are several different ways to look at this).
Hope this helps.