Here is a description of the program: Step1: open the file for reading Step2: declare variables count, max and min and initialize count to O Step3: read the first value in the file and initialize both max and min to this value. Step4: repeat the following until the end of the file is reached 4.1) read a value from the file 4.2) increment the count 4.3) if the value is smaller than min then min becomes this value 4.4) if the value is greater than max then max becomes this value Step5: print the count (number of values read), the maximum and the minimum Your output should look like: There are 6 values in the file The maximum value is 9.500000 The minimum value is 1.100000 Copy and paste your program into the box below.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.5: A Case Study: Pollen Count File Update
Problem 3E
icon
Related questions
Question

in C++

Question: Write a program, maxmin.c to find the maximum and minimum of values in the file
maxminin.txt.
Here is a description of the program:
Step1: open the file for reading
Step2: declare variables count, max and min and initialize count to 0
Step3: read the first value in the file and initialize both max and
min to this value.
Step4: repeat the following until the end of the file is reached
4.1) read a value from the file
4.2) increment the count
4.3) if the value is smaller than min then min becomes this value
4.4) if the value is greater than max then max becomes this value
Step5: print the count (number of values read), the maximum and
the minimum
Your output should look like:
There are 6 values in the file
The maximum value is 9.500000
The minimum value is 1.100000
Copy and paste your program into the box below.
Transcribed Image Text:Question: Write a program, maxmin.c to find the maximum and minimum of values in the file maxminin.txt. Here is a description of the program: Step1: open the file for reading Step2: declare variables count, max and min and initialize count to 0 Step3: read the first value in the file and initialize both max and min to this value. Step4: repeat the following until the end of the file is reached 4.1) read a value from the file 4.2) increment the count 4.3) if the value is smaller than min then min becomes this value 4.4) if the value is greater than max then max becomes this value Step5: print the count (number of values read), the maximum and the minimum Your output should look like: There are 6 values in the file The maximum value is 9.500000 The minimum value is 1.100000 Copy and paste your program into the box below.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,