flagging data

Vector Program This file http://uahcs.org/CS121/data/SSTdata.txt contains data from an instrument that measures sea surface temperature remotely. On occasion data points are corrupted falling outside an accepted range of values (Less than 0 degrees C or greater than 40 degrees C). Write a program that reads in the data from the file and stores it in a vector. Once all the data is read in find and replace all out of range values with the flag value -9999.
Then create a new file with the revised data

I need help on where to start with this program, i'm not very good at programming at all so i need all the help i can get :)
That's not hard to start, just open the file then input the values into the vector.

1
2
3
4
5
6
7
8
9
std::string line;
std::vector<float> data;

while(std::getline(file, line, ' '))
data.push_back(std::stof(line));

for(auto i=data.begin(); i<data.end(); ++i)
if(*i>40 || *i<0) *i=-9999;

Last edited on
Topic archived. No new replies allowed.