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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started