枚举输出小问题。
											我之前一直觉得这样挺对呀,今天写程序用到,发现有问题,不知道自己哪里弄错了,我认为应该输出0 1 2 3 4,但编译都没过现将问题简化,求解惑。。。大神勿喷。
当然,如果把x定义为int就可以运行,但枚举型为什么不行,书上的例题不都这么写?
 程序代码:
程序代码:#include <stdio.h>
#include<stdlib.h>
int main()
{
    enum fruit{apple, orange, banana, pineapple, pear};
    enum fruit  x;
    for(x=apple;x<=pear;x++)
        printf("%d ",x);
      system("pause");
      return 0;
      }我的编译器提示7 C:\Documents and Settings\Administrator\桌面\未命名5.cpp no `operator++(int)' declared for postfix `++', trying prefix operator instead
求解惑。。。
[ 本帖最后由 soulmate1023 于 2014-11-9 15:22 编辑 ]

 
											





 
	     
											








