我如何使用诸如此类的情况将枚举制作成字符串 枚举 {Ace,....King} 面; 转换为“Ace”而不是 0 或 1 的情况。
最佳答案
char const* faceToString(face f)
{
switch (f)
{
case Ace:
return "Ace";
case Two:
return "Two";
...
case King:
return "King"
}
}
关于c - 在 C 中如何使用大小写将枚举转换为字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28619085/