2020-06-24 16:08:11 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "HashTabelle.h"
|
|
|
|
#include <iostream>
|
|
|
|
#include <string>
|
|
|
|
#include <taskflow/taskflow.hpp>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
struct Customer {
|
|
|
|
int id;
|
|
|
|
string vorname;
|
|
|
|
string nachname;
|
|
|
|
|
|
|
|
friend ostream& operator<<(ostream& os, const Customer& c) {
|
|
|
|
os << "Id: " << c.id << "\n" << "Vorname: " << c.vorname << "\n" << "Nachname: " << c.nachname << "\n";
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
Customer c{ 20, "Max", "Mustermann" };
|
|
|
|
Customer d{ 30, "Tom", "Mot" };
|
|
|
|
|
|
|
|
|
|
|
|
HashTable<Customer> table = HashTable<Customer>(10);
|
|
|
|
|
|
|
|
table.insert(20, &c);
|
|
|
|
table.insert(30, &c);
|
|
|
|
table.insert(21, &c);
|
|
|
|
table.insert(21, &d);
|
|
|
|
|
|
|
|
std::cout << table.search(30) << std::endl;
|
|
|
|
|
|
|
|
table.remove(30);
|
|
|
|
|
|
|
|
std::cout << table.search(30) << std::endl;
|
2020-06-24 16:24:26 +02:00
|
|
|
std::cout << table.search(21) << std::endl;
|
|
|
|
std::cout << table.search(20) << std::endl;
|
2020-06-24 16:08:11 +02:00
|
|
|
|
|
|
|
table.remove(40);
|
|
|
|
|
|
|
|
table.restructure();
|
|
|
|
|
|
|
|
table.print();
|
|
|
|
}
|