Question: Write a program that will input a single integer value (all input will be exactly 8 digits long) and will store pairs of digits as

  1. Write a program that will input a single integervalue (all input will be exactly 8 digits long) and will store pairs of digits as individual integer values. The program will display the five 2-digit numbers as well as the average of these, each on their own line. Use a switch statement to print out Grade: and then either A (>=90), B ([80..89]), C ([70..79]), D ([60..69]) or F (<60) based on the calculated average.

    1. Sample

      1. Input: 54861398

      2. Output:

98

13

86

54

Avg: 62.75

Grade: D

    1. Sample

      1. Input: 64536785

      2. Output:

85

67

53

64

Avg: 77.00

Grade: C

  1. However **NEW FOR A8** - instead of repeatedly writing the same code over again as you did in A7, make use of a repetition structure (counter-controlled while loop) to shorten part of your code.

LANGUAGE: C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!