

#include <string>
#include <iostream>
//#include <ctype.h>
using namespace std;
#include "HashC.h"
#include "Aluno.h"


int hashing(const string& nome)
{
	return nome.length();
}


int hashing(const CAluno& obj)
{
	return toupper(obj.getNome()[0]) - 'A';
}


typedef CHashC<string> HashCStrings;
typedef CHashC<CAluno> HashCAlunos;


void main()
{
	cout << "Hashing coalescido : Mini Teste 2" << endl;

	cout << "Hashing coalescido de strings" << endl;

	HashCStrings ht_s;

	ht_s.inserir("teste 1");
	ht_s.inserir("1 etset");
	ht_s.inserir("ana");
	ht_s.inserir("maria");

	if (ht_s.pesquisar("ana"))
		cout << "encontrou 'ana'" << endl;
	else
		cout << "não existe 'ana'" << endl;

	if (ht_s.pesquisar("joaquina"))
		cout << "encontrou 'joaquina'" << endl;
	else
		cout << "não existe 'joaquina'" << endl;

	//ht_s.eliminar("maria");

	if (ht_s.pesquisar("maria"))
		cout << "encontrou 'maria'" << endl;
	else
		cout << "não existe 'maria'" << endl;


	cout << "Hashing coalescido de alunos" << endl;

	HashCAlunos ht_a;

	ht_a.inserir(CAluno("joao",    18));
	ht_a.inserir(CAluno("antonio", 20));
	ht_a.inserir(CAluno("ana",     17));
	ht_a.inserir(CAluno("maria",   21));

	if (ht_a.pesquisar(CAluno("ana", 17)))
		cout << "encontrou 'ana'" << endl;
	else
		cout << "não existe 'ana'" << endl;

	if (ht_a.pesquisar(CAluno( "joaquina", 23)))
		cout << "encontrou 'joaquina'" << endl;
	else
		cout << "não existe 'joaquina'" << endl;
}








