我有这个枚举器,你从一个结构中读到它的枚举{PASSING,FAILING} 它意味着显示失败或传递..它确实这样做但是我得到(状态失败0)(状态PASSING1)作为最终输出,...任何人都知道为什么1和0出现?关于该做什么的任何提示?
if(info[i].average <70)
{
info[i].status = FAILING;
}
else
{
info[i].status = PASSING;
}
switch(info[i].status)
{
case FAILING: cout << "Status FAILING";// <<endl;
break;
case PASSING: cout << "Status PASSING";// <<endl;
}
cout << info[i].status <<endl;
答案 0 :(得分:0)
制作地图:
#include <string>
#include <map>
enum TheEnumType { PASSING, FAILING };
std::map<TheEnumType, std::string> enum_names = { { PASSING, "Passing" },
{ FAILING, "Failing" } };
std::cout << enum_names[info[i].status];