Shouldn't the enum value for sin be 5 ? Instead it is always returning a garbage value. Did I miss anything important about enumeration types?Code:#include<string> #include<sstream> #include<iostream> using namespace std; class token { std::string ori_val; public: token(std::string); enum optype{oprnd,add,sub,mul,div,sin,cos,tan,log}; optype opt; double num; char sng_oprt; //std::string str_oprt; }; token::token(std::string input) { ori_val=input; istringstream in; in.str(input); char c; std::string str; double num_in; if(in>>c) { sng_oprt=c; switch (c) { case '+':opt=token::add;break; case '-':opt=token::sub;break; case '*':opt=token::mul;break; case '/':opt=token::div;break; } in.clear(); } else if(in>>num_in) { num=num_in; opt = token::oprnd; in.clear(); } else if(in>>str) { switch (str[0]) { case 's':opt=token::sin;break; case 'c':opt=token::cos;break; case 't':opt=token::tan;break; case 'l':opt=token::log;break; } } } int main() { token t("sin"); cout<<t.opt; return 0; }