Okay. I'll go another round with it.
I appreciate the input y'all.
*edit*
>> should be 2d
I agree. It would be easier for me to understand. I have to keep it 1d. I already asked the professor that.
>> while(fileIn){ //¿when will this end?
Last semester, I was pretty sure I remember a lecture about while(file) being better than while(!eof) since it checks for valid file, end of file, and something else I don't remember. However, I must be remembering it incorrectly because that's not how it's used. I'm going to take out the while loop completely. The for loop should be enough if I multiply by height and width.
>> color is pixels, stddev is a bad name (paraphrasing)
I can't change stddev, but I'm changing color to pixels. Thanks!
1 2 3 4 5 6 7
|
for(int i = 0; i < width; i++){
fin >> color[i].r; //out of bounds access
fin >> color[i].g;
fin >> color[i].b;
color.push_back(pixel()); //appending an empty element
}
|
Should I do a v.resize() on height * width before I start appending?
Is the color.push_back unnecessary then?
Thanks!