| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 344 人关注过本帖
标题:case转换错误在main函数中~~~拜托帮忙看下怎么回事啊
取消只看楼主 加入收藏
播种梦的小孩
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-3-19
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:0 
case转换错误在main函数中~~~拜托帮忙看下怎么回事啊
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include <math.h>
main()
{
    int data1,data2,i;
    int count=0;
    int reply;

    srand(time(NULL));

    while( count < 10 )
    {
        i=rand()%4+1;

        switch(i)
        case 1:
        {
            data1=rand()%11;
            data2=rand()%11;

            printf("%d+%d=",data1,data2);
            scanf("%d",&reply);
        }
            break;

        case 2:
        {
            data1=rand()%11;
            data2=rand()%11;

            while (data1<data2)
            {
                data1=rand()%11;
                data2=rand()%11;
            }
            printf("%d-%d=",data1,data2);
            scanf("%d",&reply);
        }
            break;

        case 3:
        {
            data1=rand()%11;
            data2=rand()%11;

            printf("%d*%d=",data1,data2);
            scanf("%d",&reply);
        }
            break;

        case 4:
        {
            data1=rand()%11;
            data2=rand()%11;

            while(data2==0)
            {
                data1=rand()%11;
                data2=rand()%11;
            }

            while(data2!=0)
            {
                int x=fmod(data1,data2);
                while(x!=0)
                {
                    data1=rand()%11;
                    data2=rand()%11;
                }
            }

            printf("%d/%d=",data1,data2);
            scanf("%d",&reply);
        }
            break;

        count++;
    }
  }
搜索更多相关主题的帖子: include count 
2011-03-19 16:52
快速回复:case转换错误在main函数中~~~拜托帮忙看下怎么回事啊
数据加载中...
 
   



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

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