C++ Visual Studio Debugger Error with Enumeration -
i'm building bulls , cows game(have guess word through command prompt) i'm having problem in microsoft visual studio 2017 i'm using enum check input errors.if there error, there supposed error in debugger word_length or if ok should display ok. when run debugger, instead of displaying message ok or word_length displays numbers.
could doing wrong? or vs.. find weird because i'm doing alongside c++ course code should fine. help!
--code--------
here declare enumeration
enum class eguessstatus { ok, not_isogram, wrong_length, not_lowercase }; here if word length not right, return error
else if (guess.length() != gethiddenwordlength()) //if word length //wrong, return error { return eguessstatus::wrong_length; } and if guess ok, return ok
else { //otherwise, return ok return eguessstatus::ok; } and here in main.cpp mark debug.
eguessstatus status = bcgame.checkguessvalidity(guess); in situation word 'planet' , can see, debugger spews out weird numbers.
i'm not sure totally understand question seems you're trying convert enum (who's underlying type integer) string representation?
if can use lookup table. use std::map , map off human readable message each of enums. can 'std::string msg = lookup_map_.at(enum);'.
Comments
Post a Comment