Using enums correctly -


wondering why can't use following code.

enum  player_state { fast, slow, focus, bust, out};     if (score >= 100)         player_state = fast;     else if (score > 50)         player_state = slow;     else if ((score <= 50) && (score > 1))         player_state = focus;     else if ((score == 1) || (score < 0))         player_state = bust;     else         player_state = out; 

i error @ assignment's (=).

any tips? thought this, if not this.

an enum type declaration. have make variable uses type. instance

enum  player_states { fast, slow, focus, bust, out}; player_states playerstate = fast; 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -