Ok i apologize in advance for my ignorance but i have just started learning c++ and my first program went off without a hitch now this one that im doing completely on my own is giving me some hiccups. The best i can tell is that im just having some problems compiling it through xcode or its something that i am not experienced enough yet to diagnose any help would be greatly appreciated.
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
const int LIMIT = 10000;
int number = 2;
while (number <= LIMIT) {
int sumofDivisor = 0;
int posDivisor = 1;
while (posDivisor <= number / 2)
if (number % posDivisor == 0)
sumofDivisor = sumofDivisor + posDivisor;
if (number == sumofDivisor)
cout << number << "is perfect. \n";
posDivisor ++;
}
number ++;
}