一道枚举类型的题目不懂!求教

来源:百度知道 编辑:UC知道 时间:2024/09/22 01:40:42
11.(枚举类型)定义一个枚举类型,包含整数之间的三种大小关系(greater than, equal to, less than)。输入两个整数,进行比较并将相应的关系作为结果打印出来。(打印结果可以是枚举成员对应的数字)
刚学C++,不懂枚举类型有啥用。。。谁能教教我这题怎么做??

#include<stdio.h>
int main()
{
enum relation{greaterthan,equalto,lessthan};
int a,b;
printf("input two integers a,b:");
scanf("%d,%d",&a,&b);
if(a>b)
{
printf("%d",greaterthan);
}
else if(a<b)
{
printf("%d",lessthan);
}
else
{
printf("%d",equalto);
}
}
本人菜鸟,不要笑话