Question: Language C++ Calculation A finite-processing number is a number defined by the following process: Start with any positive integer, replace this number by the sum
Language C++ Calculation

A "finite-processing" number is a number defined by the following process: Start with any positive integer, replace this number by the sum of the squares of its digits in base ten, and repeat this sum-of-squared-digits process until the number equals to 1. For example, 28 22 +82 = 68 +62 +82 = 100 12 +02 +02 = 1 Not all the numbers have the property above, which are called "infinite-processing" numbers. Such numbers will fall into the following infinite loop during the sum-of-squared digits process: 4 + 16 + 37 58 89 145 - 42 20 - 4 For example, 27 22 + 72 = 53 52 + 32 = 34 32 +42 = 25 - 22 + 52 = 29 22 +92 = 85 82 +52 = 89 +82 +92 = 145 - 12 +42 +52 = 42 42 + 22 = 20 - 22 +02 = 4 ...... Write a program according to the requirements: We assume that the input positive integer (data type: int) is valid. No need to check its correctness. We assume that the int type is large enough for the input, but we do not assume that your program knows the number of digits that the input will contain before the user's input. Display this input number is a finite-processing or an infinite-processing number. Implement the bubble sorting algorithm to sort each number appeared during the sum-of-squared- digits process in an increasing order. Note 1: You can use an int array[100] to store these to-be-sorted numbers, and we assume the array size of 100 is large enough. Note 2: You can use 4 to detect the "infinite-processing" number. Note 3: Your code should NOT use the function pow(). Example-1 (Inputs are underlined): Enter a positive integer: 28 It is a finite-processing number 1 68 100 Example-2 (Inputs are underlined): Enter a positive integer: 100 It is a finite-processing number 1 Example-3 (Inputs are underlined): Enter a positive integer: 27 It is an infinite-processing number 4 20 25 29 34 42 53 85 89 145
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
