Question
Help, C++ Question Given an integer, n, the integers a and b are said to be factors (or divisors) of n if a*b = n.
Help, C++ Question
Given an integer, n, the integers a and b are said to be factors (or divisors) of n if a*b = n.
Given an integer, n, that is greater than 0,
n is an abundant number if the sum of its factors is greater than 2* n
n is a deficient number if the sum of its factors is less than 2* n
n is a perfect number if the sum of its factors is equal to 2* n
Design and implement a complete C++ program that will
read a series of integers from a file (via Linux redirection) and display (to the screen) a table with 4 columns (n, abundant, deficient, perfect)
for each integer read from the file, display
o the integer
o an 'X' or a blank in the appropriate column of the table (note: if the integer does not fall into any of the 3 categories, leave all columns blank)
when all data has been read and processed, display the average of the abundant numbers with a label and 2 digits to the right of the decimal
NOTES:
Assume that all input values in the data file will be integers (positive, negative, or zero).
Right justify the numbers and 'X's in the table. Assume maximum number of columns needed to display a number is 12.
When constructing data files, separate each integer with whitespace. Each line in the data file should be terminated with a linefeed.
Sample terminal session: [joj5@bobby 17FAl$ cat data4nine 4 17 24 -23 0 6 18 28 [joj5@bobby 17FAIS [joj5@bobby 17FAls g++ ex09.cpp [joj5@bobby 17FAl$./a.out
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started