Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

Understand the role of internal marketing and communications.

Answered: 1 week ago