Problem With Return Statement

Hey guys, I've got a homework assignment here, and it works great, except that I cannot get it to re-initialize. Once it finishes its job it just closes. I'm not 100% how to get these return statements to work. Can you help me out?? Thanks a bunch


//This program finds perfect integers
#include <iostream>

using namespace std;

int main()
{
int i, number;
int sum=0;

cout <<"Enter an integer to test (<2 to exit):";
cin >> number;
if (number==2)
{
cout <<"Normal program termination.";
return 0;
}
else
{
cout <<"Testing ";
cout << number;
cout <<"...";
}

for (int i = 1; i <= number/2; ++i)
{

if (number%i == 0)
{
sum+=i;
}
}
if (sum==number)
{
cout <<number;
cout <<" is perfect.";
return number;
}
else
{
cout <<number;
cout <<" is NOT perfect.";
return number;
}
}
Whatever you thought "return" does, it doesn't.
Make sure to reread the chapter about functions.
Topic archived. No new replies allowed.