Colas error al llamar la funcion
Publicado por cesar (44 intervenciones) el 28/11/2019 15:15:56
Buen dia amigos espero su ayuda
El error en este programa esta en esta linea insertarcola( frente, fin, dato); al llamar a la funcion me queda este error 34 34 J:\Programacion Psaint\C++curso ats\v101colasinsertar.cpp Error invalid conversion from 'nodo' to 'int' -fpermissive
34 34 J:\Programacion Psaint\C++curso ats\v101colasinsertar.cpp Error too many arguments to function 'void insertarcola(nodo&, int)'
Puede alquien ayudarme ??
//COMO INVOCAR FUNCION ENTONCES???//
El error en este programa esta en esta linea insertarcola( frente, fin, dato); al llamar a la funcion me queda este error 34 34 J:\Programacion Psaint\C++curso ats\v101colasinsertar.cpp Error invalid conversion from 'nodo' to 'int' -fpermissive
34 34 J:\Programacion Psaint\C++curso ats\v101colasinsertar.cpp Error too many arguments to function 'void insertarcola(nodo&, int)'
Puede alquien ayudarme ??
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using namespace std;
struct nodo{ int dato; nodo *siguiente; };
void insertarcola(nodo &,int); bool cola_vacia(nodo ); //void sacarpila(nodo *&,int&);
int main(){
nodo frente = NULL; nodo fin = NULL;
int dato; cout<<"digite un numero ";
cin >> dato;
insertarcola( frente, fin, dato);
//COMO INVOCAR FUNCION ENTONCES???//
1
2
3
4
5
6
7
8
9
10
getch(); return 0;
} void insertarcola(nodo &frente,nodo &fin,int n ){ nodo *nuevo_nodo = new nodo(); nuevo_nodo->dato = n; nuevo_nodo->siguiente = NULL; if (cola_vacia(frente)){ frente = nuevo_nodo; } else{ fin->siguiente = nuevo_nodo;
}
fin = nuevo_nodo;
cout<<" elemento "<<n<< " agregado sido agregado a cola correctamente\n";
} bool cola_vacia(nodo *frente){ return (frente==NULL)? true : false; }
Valora esta pregunta


0