Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me with my C++ code? It's suppose to read from a file called rainfall_data.txt and display the average number of days without

Can someone help me with my C++ code? It's suppose to read from a file called "rainfall_data.txt" and display the average number of days without receiving rainfall greater than or equal to 0.10". Everything works except for one thing. Some of the data in the file looks like this:

0.13 0.00 T 0.00 0.00 0.00 T 1.61 0.00 0.93 0.00 0.23

And when I run it I get an error because of the "T". Is there a way to make the T value equal to 0.01 so I dont have to manually change it by hand? Thank you.

#include #include using namespace std; int main() { string inFileName="rainfall_data.txt"; fstream inFileStr(inFileName.c_str(), ios::in); float myArray[200]; float value; float avg; int i = 0; int z = 0;

while(inFileStr >> value) { myArray[i] = value; 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

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

3. Existing organizations and programs constrain behavior.

Answered: 1 week ago

Question

Consider this article:...

Answered: 1 week ago