How can I solve the following errors, thanks.
[Error] 'IntercDirectoIzq' was not declared in this scope
[Error] expected primary-expression before '>' token
[Error] 'Orden' was not declared in this scope
[Error] no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream}' and 'Alumno')
Alumno.cpp
#include "Alumno.h"
#include "Arreglo.h"
#include "MetOrdena.h"
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
Arreglo<Alumno> Escuela;
Escuela.Lectura();
IntercDirectoIzq<Alumno> Orden;
Orden.Ordena(&Escuela);
Escuela.Escribe();
if (Escuela.RegresaTam() != 0)
cout<<"Los datos del primer alumno son:"<<endl;
cout<< Escuela.RegresaValor(0);
return 0;
}
Alumno.h
#include<iostream>
#include<stdio.h>
#include<cstring>
using namespace std;
class Alumno {
private:
int Clave;
char Nombre[64];
public:
Alumno();
Alumno(int, char *);
int operator > (Alumno);
friend istream &operator >> (istream &, Alumno &);
friend ostream &operator << (ostream &, Alumno &);
};
Alumno::Alumno()
{}
Alumno::Alumno(int Cla, char Nom[])
{
Clave= Cla;
strcpy(Nombre, Nom);
}
int Alumno::operator > (Alumno ObjAl)
{
if (Clave > ObjAl.Clave)
return 1;
else
return 0;
}
istream &operator >> (istream &Lee, Alumno &ObjAl)
{
cout<<"\n\nIngrese clave del alumno: ";
Lee>>ObjAl.Clave;
cout<<"\n\nIngrese nombre del alumno: ";
Lee>>ObjAl.Nombre;
return Lee;
}
ostream &operator << (ostream &Escribe, Alumno &ObjAl)
{
Escribe<<"\n\nDatos del alumno\n";
Escribe<<"\nClave: "<<ObjAl.Clave;
Escribe<<"\nNombre: "<<ObjAl.Nombre<<"\n";
return Escribe;
}
Arreglo.h
#include<iostream>
#include<stdio.h>
#define MAX 100
using namespace std;
template <class T>
class Arreglo
{
private:
T Datos[MAX];
int Tam;
public:
Arreglo();
int RegresaTam();
T RegresaValor(int);
void AsignaValor(int, T);
void Lectura();
void Escribe();
};
template <class T>
Arreglo<T>::Arreglo()
{
Tam= 0;
}
template <class T>
int Arreglo<T>::RegresaTam()
{
return Tam;
}
template <class T>
T Arreglo<T>::RegresaValor(int Indice)
{
return Datos[Indice];
}
template <class T>
void Arreglo<T>::AsignaValor(int Indice, T Valor)
{
Datos[Indice]= Valor;
}
template <class T>
void Arreglo<T>::Lectura()
{
int Indice;
do {
cout<<"\n\n Ingrese total de elementos: ";
cin>> Tam;
} while (Tam < 1 || Tam > MAX);
for (Indice= 0; Indice < Tam; Indice++)
{
cout<<"\nIngrese el "<<Indice + 1<<" dato: ";
cin>> Datos[Indice];
}
}
template <class T>
void Arreglo<T>::Escribe()
{
int Indice;
if (Tam > 0)
{
cout<<"\n\n";
for (Indice= 0; Indice < Tam; Indice++)
cout<< "\t" << Datos[Indice];
cout<<"\n\n";
}
else
cout<< "\n No hay elementos almacenados.";
}
MetOrdena.h
#define MAX 100
template <class T>
class Arreglos
{
//private:
public:
T Datos[MAX];
int Tam;
Arreglos();
int RegresaTam();
T RegresaValor(int);
void AsignaValor(int, T);
void Intercambia(int, int);
void IntercDirectoIzq();
void InsercionDirecta();
void SeleccionDirecta();
void QuickSort();
void Reduce(int, int);
void Lectura();
void Escribe();
};
template <class T>
Arreglos<T>::Arreglos()
{
Tam=0;
}
template <class T>
void Arreglos<T>::Intercambia(int Ind1, int Ind2)
{
T Auxiliar;
Auxiliar= Datos[Ind1];
Datos[Ind1]= Datos[Ind2];
Datos[Ind2]= Auxiliar;
}
template <class T>
void Arreglos<T>::IntercDirectoIzq()
{
int Ind1, Ind2;
for (Ind1= 1; Ind1< Tam; Ind1++)
for (Ind2= Tam-1; Ind2 >= Ind1; Ind2--)
if (Datos[Ind2-1] > Datos[Ind2])
Intercambia(Ind2-1, Ind2);
}
template <class T>
void Arreglos<T>::InsercionDirecta()
{
int Auxiliar, Indice, IndAux;
for (Indice= 1; Indice < Tam; Indice++)
{
Auxiliar= Datos[Indice];
IndAux= Indice - 1;
while ((IndAux >= 0) && (Auxiliar < Datos[IndAux]))
{
Datos[IndAux+1]= Datos[IndAux];
IndAux--;
}
Datos[IndAux+1]= Auxiliar;
}
}
template <class T>
void Arreglos<T>::SeleccionDirecta()
{
int Menor, Ind1, Ind2, Ind3;
for (Ind1= 0; Ind1 < Tam-1; Ind1++)
{
Menor= Datos[Ind1];
Ind2= Ind1;
for (Ind3= Ind1+1; Ind3 < Tam; Ind3++)
if (Datos[Ind3] < Menor)
{
Menor= Datos[Ind3];
Ind2= Ind3;
}
Datos[Ind2]= Datos[Ind1];
Datos[Ind1]= Menor;
}
}
template <class T>
void Arreglos<T>::QuickSort()
{
Reduce(0, Tam-1);
}
template <class T>
void Arreglos<T>::Reduce(int Inicio, int Fin)
{
if ( Tam > 0)
{
int Izq, Der, Posic, Bandera;
Izq= Inicio;
Der= Fin;
Posic= Inicio;
Bandera= 1;
while (Bandera)
{
Bandera= 0;
while ((Datos[Posic] <= Datos[Der]) && (Posic != Der))
Der--;
if (Posic != Der)
{
Intercambia(Posic, Der);
Posic= Der;
while ((Datos[Posic] >= Datos[Izq]) && (Posic != Izq))
Izq++;
if (Posic != Izq)
{
Bandera=1;
Intercambia(Posic, Izq);
Posic= Izq;
}
}
}
if ((Posic-1) > Inicio)
Reduce(Inicio, Posic-1);
if (Fin > (Posic+1))
Reduce(Posic+1, Fin);
}
}