Task 1 Download the file named random.txt. This file contains a long list of random numbers. Copy the file to your program development folder, then write a program readFile.cpp that opens the file, reads all the numbers from the file, and calculates the following: 1) The number of numbers in the file 2) The sum of all the numbers in the file (a running total) 3) The average of all the numbers in the file The program should display the number of numbers found in the file, the sum of the numbers, and the average of the numbers. It also needs to write these results to an output file named

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
random.txt
42
468
335
501
170
725
479
359
963
465
706
146
282
828
962
492
996
943
828
437
392
605
903
154
293
383
422
717
719
896
448
727
772
539
870
913
668
300
36
895
704
812
323
334
674
665
142
712
254
869
548
645
663
758
 
 
 
 
 
 
 
38
860
724
742
530
779
317
36
191
843
289
107
41
943
265
649
447
806
891
730
371
351
7
102
394
549
630
624
85
955
757
841
967
377
932
309
945
440
627
324
538
539
119
83
930
542
834
116
640
659
705
931
978
307
 
 
 
 
 
 
 
674
387
22
746
925
73
271
830
778
574
98
513
987
291
162
637
356
768
656
575
32
53
351
151
942
725
967
431
108
192
8
338
458
288
754
384
946
910
210
759
222
589
423
947
507
31
414
169
901
592
763
656
411
360
 
 
 
 
 
 
 
625
538
549
484
596
42
603
351
292
837
375
21
597
22
349
200
669
485
282
735
54
1000
419
939
901
789
128
468
729
894
649
484
808
422
311
618
814
515
• Write programs using file I/O
• Design programs with looping logic
Task 1
Download the file named random.txt. This file contains a long list of random numbers. Copy
the file to your program development folder, then write a program readFile.cpp that opens
the file, reads all the numbers from the file, and calculates the following:
1) The number of numbers in the file
2) The sum of all the numbers in the file (a running total)
3) The average of all the numbers in the file
The program should display the number of numbers found in the file, the sum of the numbers,
and the average of the numbers. It also needs to write these results to an output file named
results.txt.
Task 1 Sample Output
Number of numbers: 200
Sum of the numbers: 105527
Average of the numbers: 527.635
Task 2
Write a program minmax.cpp with a loop that lets the user enter a series of integers. The user
should enter -99 to signal the end of the series. After all the numbers have been entered, the
program should display the largest and smallest numbers entered.
Transcribed Image Text:• Write programs using file I/O • Design programs with looping logic Task 1 Download the file named random.txt. This file contains a long list of random numbers. Copy the file to your program development folder, then write a program readFile.cpp that opens the file, reads all the numbers from the file, and calculates the following: 1) The number of numbers in the file 2) The sum of all the numbers in the file (a running total) 3) The average of all the numbers in the file The program should display the number of numbers found in the file, the sum of the numbers, and the average of the numbers. It also needs to write these results to an output file named results.txt. Task 1 Sample Output Number of numbers: 200 Sum of the numbers: 105527 Average of the numbers: 527.635 Task 2 Write a program minmax.cpp with a loop that lets the user enter a series of integers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered.
Task 2 Sample Output
You will enter a series of integers and I will then tell you
the largest and the smallest numbers you entered.
Enter -99 to terminate the series.
Enter an integer (-99 to quit): 245
Enter another integer (-99 to quit): 333
Enter another integer (-99 to quit): 457
Enter another integer (-99 to quit): 822
Enter another integer (-99 to quit): 29
Enter another integer (-99 to quit): 100
Enter another integer (-99 to quit): 31
Enter another integer (-99 to quit): 22
Enter another integer (-99 to quit): 144
Enter another integer (-99 to quit): -99
The max number you entered is 822.
The min number you entered is 22.
Note
Copy and paste your console outputs after the end of your source file. Remember to comment
the output with /* and */ or multiple //.
Avoid cryptic variable names and poor indentations.
Transcribed Image Text:Task 2 Sample Output You will enter a series of integers and I will then tell you the largest and the smallest numbers you entered. Enter -99 to terminate the series. Enter an integer (-99 to quit): 245 Enter another integer (-99 to quit): 333 Enter another integer (-99 to quit): 457 Enter another integer (-99 to quit): 822 Enter another integer (-99 to quit): 29 Enter another integer (-99 to quit): 100 Enter another integer (-99 to quit): 31 Enter another integer (-99 to quit): 22 Enter another integer (-99 to quit): 144 Enter another integer (-99 to quit): -99 The max number you entered is 822. The min number you entered is 22. Note Copy and paste your console outputs after the end of your source file. Remember to comment the output with /* and */ or multiple //. Avoid cryptic variable names and poor indentations.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
File Input and Output Operations
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education