Hi guys, I've finished making a Double-Linked List in C++ which basically
changes a Binary number to a Decimal using Recursivity.
but when I compile it, I get an error that says
error: no matching function for call to 'ListaDoblementeLigada::B2AB10Recursivo(int&, int&, NodoDoble)'
note: candidates are: void ListaDoblementeLigada::B2AB10Recursivo(int&, int&, NodoDoble*)
This is a snippet of the code where I get the error (Line 9) :
1 2 3 4 5 6 7 8 9 10 11 12 13
|
class Programa
{
public:
static void Principal()
{
int num=0,k=0;
ListaDoblementeLigada objLista;
objLista.CrearLista();
objLista.B2AB10Recursivo(num,k,objLista.RetornaUltimo());
objLista.MostrarLista();
cout<<"en base 2 ="<<num<<"en base 10";
}
};
|
Here's the code for the void function B2AB10Recursivo (it stands for Base 2 to Base 10 Recursivity in Spanish)
1 2 3 4 5 6 7 8 9 10
|
void B2AB10Recursivo(int& num, int& k, NodoDoble* p)
{
if(p!=cab)
{
num+=(int)((p->dato-48)*pow(2,k)); //pow(2,k) <---> 2^k
k++;
*p=p->RetornaLigaIzq();
B2AB10Recursivo(num,k,p);
}
}
|
Im guessing the problem must be with all the ampersand (&) signs, I get confused because I'm not sure which numbers I have to send by reference and which ones I don't.
I'm new here, so I'm not sure if I can paste Spanish codes here so sorry in advance if I broke any rules, any help would be much appreciated.