Question: Can someone help me with this C++ code? I keep getting an error and I am not sure why. Also the rainfall_data.txt data file contains

Can someone help me with this C++ code? I keep getting an error and I am not sure why.

Also the "rainfall_data.txt" data file contains the following information:

0.00

0.01

0.07

0.00

T

0.00

1.23

1.20

0.00

0.09

0.11

0.00

2.15

#include #include #include using namespace std;

int main(){ string inFileName="rainfall_data.txt"; fstream inFileStr(inFileName.c_str(), ios::in); float myArray[200];

// change to string string value; float avg; int i = 0; int z = 0;

while(inFileStr >> value) { // now check if not T convert float if(value != "T") myArray[i] = stof(value);

else myArray[i] = 0.01;

i++; }

int l=0; for(int k=0;k

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!