Well, I'm trying to make a Permutation/Combination calculator and I'm getting weird errors when trying to compile like so:
Undefined symbols for architecture x86_64:
"combination(int, int)", referenced from:
_main in probability-e55a71.o
(maybe you meant: __Z11combinationiii)
"permutation(int, int, int)", referenced from:
_main in probability-e55a71.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation
int permutation(int factn, int facty)
{
int p1;
p1 = factn/facty;
cout << "The permutation is: " << p1 << endl;
return(0);
}
int combination(int factn, int factr, int facty)
{
int p2;
p2=factn/(factr*facty);
cout << "The combination is: " << p2 << endl;
return(0);
}
also this is wrong
1 2 3
cout << "Either n or r was a negative number, Please retry with " <<
cout << "positive numbers only." << endl;
I fixed the prototypes, but now I'm having problem with the wrong outputs, I could use a fresh set of eyes on this. Also, What do you mean about
1 2
cout << "Either n or r was a negative number, Please retry with " <<
cout << "positive numbers only." << endl;
this being wrong?
Basically, the code isn't doing the factorial the right way, I don't believe. I'm not sure if my function is set up correctly to use the n, r, or y variable in the factorial function. Here is the new code.