C语言:输出枚举型变量的值,应该用什么格式说明
2个回答
2017-07-08
展开全部
不知道C语言的具体格式是什么,我是做java的,但是枚举基本上都是相同的
package cn.com.his.model.constants;
import java.util.ArrayList;
import java.util.List;
/**
* 六分钟心律失常
*
*
*
*/
public enum LfzXlscEnum
{
offxzb(1, "偶发房性早搏 "), pffxzb(2, "频发房性早搏 "),ofsxzb(3,"偶发室性早搏"),pfsxzb(4,"频发室性早搏"),qt(99, "其他");
private int type;
private String mean;
public int getType()
{
return type;
}
public void setType(int type)
{
this.type = type;
}
public String getMean()
{
return mean;
}
public void setMean(String mean)
{
this.mean = mean;
}
private LfzXlscEnum(int type, String mean)
{
this.type = type;
this.mean = mean;
}
public static String getLfzXlscEnum(String type)
{
String mean="";
if(type!=null){
String[] types = type.split(",");
for (String str : types)
{
LfzXlscEnum[] arrays = LfzXlscEnum.values();
for (LfzXlscEnum bzEnum : arrays)
{
if (str.equals(bzEnum.getType()+""))
{
if(99 != bzEnum.getType()){
mean = mean + bzEnum.getMean()+";";
}
}
}
}
}
return mean;
}
public static List<LfzXlscEnum> getXlscEnumList()
{
List<LfzXlscEnum> list = new ArrayList<LfzXlscEnum>();
LfzXlscEnum[] arrays = LfzXlscEnum.values();
for (LfzXlscEnum bzEnum : arrays)
{
list.add(bzEnum);
}
return list;
}
}
package cn.com.his.model.constants;
import java.util.ArrayList;
import java.util.List;
/**
* 六分钟心律失常
*
*
*
*/
public enum LfzXlscEnum
{
offxzb(1, "偶发房性早搏 "), pffxzb(2, "频发房性早搏 "),ofsxzb(3,"偶发室性早搏"),pfsxzb(4,"频发室性早搏"),qt(99, "其他");
private int type;
private String mean;
public int getType()
{
return type;
}
public void setType(int type)
{
this.type = type;
}
public String getMean()
{
return mean;
}
public void setMean(String mean)
{
this.mean = mean;
}
private LfzXlscEnum(int type, String mean)
{
this.type = type;
this.mean = mean;
}
public static String getLfzXlscEnum(String type)
{
String mean="";
if(type!=null){
String[] types = type.split(",");
for (String str : types)
{
LfzXlscEnum[] arrays = LfzXlscEnum.values();
for (LfzXlscEnum bzEnum : arrays)
{
if (str.equals(bzEnum.getType()+""))
{
if(99 != bzEnum.getType()){
mean = mean + bzEnum.getMean()+";";
}
}
}
}
}
return mean;
}
public static List<LfzXlscEnum> getXlscEnumList()
{
List<LfzXlscEnum> list = new ArrayList<LfzXlscEnum>();
LfzXlscEnum[] arrays = LfzXlscEnum.values();
for (LfzXlscEnum bzEnum : arrays)
{
list.add(bzEnum);
}
return list;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询