Hey Guys,
I tried to develop a simple Program which finds out a number is prime or composite, but the program always return composite, I dont know what is the problem, can anyone find out what is the error?
int main()
{
int number, result;
number = get_num();
result = prime_func(number);
if(result=='1')
{
cout<<"The Entered number is PRIME.\n";
}
else
{
cout<<"The Entered Number is COMPOSITE.\n";
}
Thanks for your comments, coder777 sorry i didnt put my code in tags cause i am new to this website, the problem did not solve yet i think it has mathematical and logical problem but i dont know where?
ne555 if i dont include *.cpp file, the program will get error and will not run.
> if i dont include *.cpp file, the program will get error and will not run.
`I've got an error' is not an error message.
<nolyc> Undefined reference is a linker error.
It's not a compile error. #includes don't help. [*]
You did not define the thing in the error message, you forgot to link the file that defines it, you forgot to link to the library that defines it, or, if it's a static library, you have the wrong order on the linker command line.
Check which one. (Note that some linkers call it an unresolved external)
[*] You are not supposed to put function definitions in header files (risk of `multiple definition')
However there are two exceptions: inline and template.