I am a C++ beginner and I am trying to write a code about an application for dynamic allocation in memory which uses chained hash tables to implement some data about persons iam using a no as a key and a name as my data I defined the class tables in the main program and tried to execute the project but I always have an error of

no matching function for call to table::insert(int,const char [5])
candidates are :bool table insert (TKT&,TDT&)

the problem arises for every line in which i call any member function for the class table i just donot know how to get through this

i have 2 codes the class code:

#include <cstdlib>
#include <iostream>
#include <conio.h>
#include <string>
#include <assert.h>
using namespace std;
typedef int TKT;
typedef string TDT;
const int maxsize=5;
class table
{public: 
        table();
        bool insert(TKT &inskey,TDT &insdata);
        bool lookup(TKT &lkey,TDT &ldata);
        void deletekey(TKT &delkey);
        ~table();
        void dump();
private: 
struct node;
typedef node* link;
struct node
{TDT data;
TKT key;
link next;
};
link T[maxsize-1];
int hash(TKT &key);
bool search(link &slotptr,TKT skey);
};


table::table()
{for (int i=0;i<maxsize;i++)
T[i]=NULL;
}


bool table::insert(TKT &inskey,TDT &insdata)
{link ptr;
int d=hash(inskey);
ptr=T[d];
bool found=search(ptr,inskey);  
if(found)
{ptr->data=insdata;
link head,ptrprv; 
ptrprv=T[d];
head=T[d]->next;
while(ptrprv->next!=ptr)
ptrprv=ptrprv->next;
ptrprv->next=T[d];
T[d]=ptr;
ptrprv->next->next=ptr->next;
ptr->next=head;
}
else
{link addednode;
addednode=new node;
assert(addednode);
addednode->data=insdata;
addednode->key=inskey;
addednode->next=T[d];
T[d]=addednode;
}
TDT kdata;
bool inserted=lookup(inskey,kdata);
if (kdata!=insdata)
return false;
return inserted;}


bool table::lookup(TKT &lkey,TDT &ldata)
{link ptr;
int d=hash(lkey);
ptr=T[d];
bool found=search(ptr,lkey);
if(found)
ldata=ptr->data;
return found;}


void table::deletekey(TKT &delkey)
{link ptr;
int d=hash(delkey);
ptr=T[d];
bool found=search(ptr,delkey);
if (found)
{link ptrprv=T[d];
if (ptr==T[d])
{T[d]=ptr->next;
delete ptr;
return;}
while(ptrprv->next!=ptr)
ptrprv=ptrprv->next;
ptrprv->next=ptr->next;
delete ptr;
}
return;
}


table::~table()
{link delptr;
for (int i=0;i<maxsize;i++)
while (T[i]!=NULL)
{delptr=T[i];
T[i]=T[i]->next;
delete delptr;}
}


int table::hash(TKT &key)
{return key%maxsize;}


bool table::search(link &slotptr,TKT skey)
{
while(slotptr!=NULL)
if (slotptr->key==skey)
return true;
return false;}
void table::dump()
{link show;
for (int i=0;i<maxsize;i++)
for (i=0;i<maxsize;i++)
{show=T[i];
while(show!=NULL)
{cout<<show->key<<" "<<show->data<<endl; ;
show=show->next;}}
}

and the main program code:

#include <iostream.h>
#include <conio.h>
#include <string>
#include "table.h"
using namespace std;

int main()
{table IDpopulation;bool a;
a=IDpopulation.insert(1,"jaki");
a=IDpopulation.insert(2,"lucy");
a=IDpopulation.insert(3,"kate");
a=IDpopulation.insert(4,"suzzane");
a=IDpopulation.insert(5,"manjawa");
a=IDpopulation.insert(6,"john");
a=IDpopulation.insert(7,"gara");
found1=IDpopulation.lookup(3,"salfi");
cout<<found1;
found2=IDpopulation.lookup(3,"dany");
cout<<found2;
IDpopulation.deletekey(6);
found3=IDpopulation.lookup(6,"tom");
cout<<found3<<endl;

IDpopulation.dump();
getche();
return 0;
}

need help ASAP

Declare class table member functions with const parameters:

bool insert(const TKT& inskey, const TDT& insdata);
...

Consider anytable.insert(6,"john") . It's impossible to bind non-const std::string reference to char array "john". However it's possible to bind const std::string reference to temporary std::string object produced by "john" => std::string("john") conversion.

Yet another remark: type aliases TKT and TDT do not clarify your code (quite the contrary)...

This question has already been answered. Start a new discussion instead.