Click here to Skip to main content
11,647,828 members (58,690 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ Homework
So, here is the problem:

Suppose m and n are integers and m is nonozero. Recall that m is called a divisor of n if n = mt for some integer t; that is, when m divides n, the remainder is 0. Moreover, m is called a proper divisor of n if m < n and m divides n. A positive integer is called perfect if it is the sum of its positive proper divisors. For example, the positive proper divisiors of 28 are 1, 2, 4, 7, and 14 and 1 + 2 + 4 + 7 + 14 = 28. Therefore, 28 is a perfect. Write a program that do the following:

a. Output the first four perfect numbers
b. Input a positive integer number and determine whether the integer is perfect. Validate the input. Ask the user to enter another input until the user enters 0.

You are required to implement the following function:

bool sumOfAllProperDivisors (int m)
The function returns true if the sum of positive proper divisors of number m is equal to m;otherwise, it returns false.

You NEED to use bool sumOfAllProperDivisors. How can we make this program work?
Posted 15-Oct-12 4:09am
Edited 15-Oct-12 4:13am
Wes Aday103.2K
Wes Aday at 15-Oct-12 10:13am
First: this is not a problem. This is homework. Second: How do you make this program work? By writing some code. Pay attention in class. Read your textbook.
Sergey Alexandrovich Kryukov at 15-Oct-12 15:00pm
This is the answer. Even though there is no a question.
geekbond at 15-Oct-12 10:29am
Oh, sorry. CP does not answer homework. Listen in class and atleast you could've written some of what you've tried and we'll be happy to point you in the right direction.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Why do we not do your homework. (Compliments of JSOP)[^]

This is not a difficult problem. The logic required is clearly laid out for you in your question text. I would suggest you break down the question into its smaller components and solve each component separately. Then tie the components together into your final solution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 500
1 F-ES Sitecore 370
2 DamithSL 290
3 CPallini 290
4 OriginalGriff 277
0 OriginalGriff 1,342
1 994
2 DamithSL 971
3 Sergey Alexandrovich Kryukov 873
4 CPallini 845

Advertise | Privacy | Mobile
Web04 | 2.8.150804.4 | Last Updated 15 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100