Hash Table Interpreter

I am trying to make a hash table interpreter and I am getting these errors:
Any suggestions are appreciated!


Errors:


main.cpp:100:58: error: invalid operands to binary expression ('node' and 'int')
if(table[hashString(temp.getName())] != 0){
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
main.cpp:105:63: error: invalid operands to binary expression ('node' and 'int')
else if(table[hashString(temp.getName())] == 0){
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
main.cpp:175:35: error: no matching function for call to 'hashString'
table[hashString(temp)].setNum(atoi(s.c_str()));
^~~~~~~~~~
main.cpp:50:5: note: candidate function not viable: no known conversion from 'node' to 'string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
int hashString(string s){
^
main.cpp:180:31: error: no matching function for call to 'hashString'
table[hashString(temp)].setNum(table[hashString(temp)].getNum()+1);
^~~~~~~~~~
main.cpp:50:5: note: candidate function not viable: no known conversion from 'node' to 'string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
int hashString(string s){
^
main.cpp:180:62: error: no matching function for call to 'hashString'
table[hashString(temp)].setNum(table[hashString(temp)].getNum()+1);
^~~~~~~~~~
main.cpp:50:5: note: candidate function not viable: no known conversion from 'node' to 'string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
int hashString(string s){
^
main.cpp:184:31: error: no matching function for call to 'hashString'
table[hashString(temp)].setNum(table[hashString(temp)].getNum()-1);
^~~~~~~~~~
main.cpp:50:5: note: candidate function not viable: no known conversion from 'node' to 'string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
int hashString(string s){
^
main.cpp:184:62: error: no matching function for call to 'hashString'
table[hashString(temp)].setNum(table[hashString(temp)].getNum()-1);
^~~~~~~~~~
main.cpp:50:5: note: candidate function not viable: no known conversion from 'node' to 'string' (aka 'basic_string<char, char_traits<char>, allocator<char> >') for 1st argument
int hashString(string s){
^





Last edited on
main.cpp:100:58: error: invalid operands to binary expression ('node' and 'int')
if(table[hashString(temp.getName())] != 0){
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~


I don't know what a "hash table interpreter" is, but what do you expect to happen when an object of type 'node' is compared to an object of type 'int'? What are you trying to accomplish on that line?
Topic archived. No new replies allowed.