hi guys,
i have been trying to make this thing work .heres the code for calculator by the way. Everything compiles fine except for push_back(). heres the code snippet.
push_back does take char . doesnt it?? if theres any mistake then please let me know. Atleast i will be able to learn from my mistake.Code:Token_value get_token() { char ch ; do{ if(!cin.get(ch)) return curr_tok = END; }while(ch !=( '/n' && isspace(ch)) ) ; switch(ch){ case ';' : case '\n' : return curr_tok = PRINT ; default : // NAME, NAME = , or error if( isalpha(ch)){ string_value = ch ; while( cin.get(ch) && isalnum (ch)) string_value.push_back(ch) ;//HERES THE ERROR. cin.putback(ch); return curr_tok = NAME ; } error("bad token"); return curr_tok = PRINT ; } } THE COMPILER ERROR:-> 53 deskcalc.cpp no matching function for call to `basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >::push_back (char &)'![]()
iostream , cctype, string, map has already been included.Map is needed to create a table of strings.



LinkBack URL
About LinkBacks




-> means "p"
is ";"