created 04/29/00; edits: 11/20/2012
DivisionPractice program from the chapter:
Here is sample output from one run:
Enter the numerator: 12 Enter the divisor: 4 12 / 4 is 3 Enter the numerator: 12 Enter the divisor : 0 You can't divide 12 by 0 Enter the numerator: glarch You entered bad data. Please try again. Enter the numerator: quit
You will need to use the method
Write a program that inputs a list of numbers that are arranged into groups of various sizes. The program outputs the sum of the numbers in each group. Each group starts with a one-line descriptive phrase. The phrase can be anything that is not a number. Some groups may have zero number in them.
Group A 23 -12 29 -84 Group B -2 -45 -90 123 26 19 -5 -30 9 Group C Last Group 12 -34 23 47 52 8
Use file redirection for the input file. (Copy and past the above data to your own text file for testing.) With the above data, the program writes:
Group A Sum = -44 Group B Sum = 5 Group C Sum = 0 Last Group Sum = 108Click here to go back to the main menu.