标题:关于enum 的 代码不知道哪里出了错
取消只看楼主
hihihi
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-11-23
 问题点数:0 回复次数:0 
关于enum 的 代码不知道哪里出了错
#include<stdio.h>
main()
{
    enum fruit{apple,orange,banana,pinapple,pear};
    enum fruit x,y,z,pri;
    int n, loop;
    n=0;
    for(x=apple;x<=pear;x++)
        for(y=apple;y<=pear;y++)
         if(x!=y)
            {
                for(z=apple;z<=pear;z++)
                 if((z!=x)&&(z!=y))
                  n++;
                  printf("\n%-4d",n);
         for(loop=1;loop<=3;loop++)
                {
                    switch(loop)
                    {
                        case1:  pri=x;    break;
                        case2:  pri=x;    break;
                        case3:  pri=z;    break;
                        default:          break;
                    }
                     switch(pri)
                     {
                        case apple:     printf("%-8s","apple");      break;
                        case orange:    printf("%-8s","orange");     break;
                        case banana:    printf("%-8s","banana");     break;
                        case pinapple:  printf("%-8s","pinapple");   break;
                        case pear:      printf("%-8s","pear");       break;
                        default:                                     break;
                     }

                }
printf("\ntotal  %d",n);
            }

}
搜索更多相关主题的帖子: 代码 HELP 
2008-11-23 07:57



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-245805-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.347916 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved