else if (toupper(option)=='C') { int k; // to store the Nth number int number; // to store the final number int count; // loop counter int i; // natural numbers cout << "Please enter which abundant number you would like to find." << endl; cout << " (i.e. A is the Nth abundant number, so you would enter 'N'" << endl; cin >> k; for (count=0; count<k; count++) { for (i=1; i<10000000; i++) { if (perfectTest(i)==1) number=i; } } cout << number << " is the " << k << "th abundant number." << endl << endl; } int perfectTest(int n) { int divisor; int sum=0; int status; for (divisor=1; divisor<n; divisor++) { if (n%divisor==0) { sum=sum+divisor; } } if (sum==n) { status = 0; } else if (sum<n) { status = -1; } else if (sum>n) { status = 1; } return status; }

I just included the relevent parts of my code, please let me know if more of it is needed. When I run the program, nothing happens after I enter in a number. I think there might be something wrong with my loops, but can't really figure it out.

This post has been edited by **lostttinc++**: 27 December 2009 - 02:59 AM