First of all, remember to post the relevant error messages when you have a problem.
Compiling your program under VC 2003.Net gave me the following error messages.
perfect_nos.cpp(21) : error C2660: 'perfTest' : function does not take 0 arguments
perfect_nos.cpp(22) : error C2660: 'factorPrint' : function does not take 0 arguments
So that means you are not passing the required arguments to the functions. The line numbers where the errors occur are 21 and 22.
if(perfTest()=true)
factorPrint();
While correcting them, I noticed that you are doing if(perfTest(Fact)=true)
factorPrint(Fact); // This is what i called the functions
It should be corrected like if(perfTest(Fact)==true)
factorPrint(Fact); // This is what i called the functions
The full corrected code is as below.
#include <iostream>
using namespace std;
bool perfTest(int Num);
void factorPrint(int Num1);
int main()
{
int num;
int Fact;
do
{
cout << "How Many Numbers Would You Like To Test? ";
cin >> num;
}
while (num<=0);
for(int a=1; a<=num; a++)
{
cout << "Please enter a possible perfect number: ";
cin >> Fact;
if(perfTest(Fact)==true)
factorPrint(Fact); // This is what i called the functions
}
return 0;
}
// First Function ===============================
bool perfTest (int Num)
{
bool perfect;
int B=0;
for(int A=1; A!=Num; A++)
{
if(Num%A==0)
{
B+=A;
}
}
if(B==Num)
perfect=true;
else
perfect=false;
return perfect;
}
//second function ===============================
void factorPrint(int Num1)
{
for(int A=1; A!=Num1; A++)
{
if(Num1%A==0)
{
cout << Num1 << ":" << A << " ";
}
}
return;
}