Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions