| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 354 人关注过本帖
标题:这一段程序有问题吗?求指导!!谢谢!
只看楼主 加入收藏
冯jungle
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2012-12-16
结帖率:87.5%
收藏
已结贴  问题点数:20 回复次数:3 
这一段程序有问题吗?求指导!!谢谢!
void band()
{
    fp2 = fopen( "b.txt", "r" );
    int  band[8][11];
    printf( "请选择:\n" );
    printf( "\t\t\t1--高数\n\t\t\t2--工图\n\t\t\t3--英语\n\t\t\t4--C语言\n\t\t\t5--航概\n\t\t\t6--体育\n\t\t\t7--思修\n" );
    scanf( "%d", &choice );
    for( i = 1 ; i <= 7; i++ )
        if( choice == i ){
            for( j = 1; j <= 7 ; j++ )
                for( i = 1;i <= 10; i++)
                band[j][i] = 0;
                for( i = 1; i <= 20; i++ )
                    for( j = 1; j <= 7; j++ ){
                        if( stu[i].cj[j] <= 10 )
                            band[j][1]++;
                        else if( stu[i].cj[j] <= 20 )
                            band[j][2]++;
                        else if( stu[i].cj[j] <= 30 )
                            band[j][3]++;
                        else if( stu[i].cj[j] <= 40 )
                            band[j][4]++;
                        else if( stu[i].cj[j] <= 50 )
                            band[j][5]++;
                        else if( stu[i].cj[j] <= 60 )
                            band[j][6]++;
                        else if( stu[i].cj[j] <= 70 )
                            band[j][7]++;
                        else if( stu[i].cj[j] <= 80 )
                            band[j][8]++;
                        else if( stu[i].cj[j] <= 90 )
                            band[j][9]++;
                        else band[j][10]++;
                    }
        }
        for( j = 1; j <= 10; j++ )
            printf( "分数段在0--%d的人数有:%d\n", 10*j, band[i][j] );

};
搜索更多相关主题的帖子: void choice 
2012-12-23 22:46
wuxia111111
Rank: 2
等 级:论坛游民
帖 子:32
专家分:60
注 册:2012-11-18
收藏
得分:15 
void band()
{
    fp2 = fopen( "b.txt", "r" );
    int  band[8][11];
    int choice;//声明
    printf( "请选择:\n" );
    printf( "\t\t\t1--高数\n\t\t\t2--工图\n\t\t\t3--英语\n\t\t\t4--C语言\n\t\t\t5--航概\n\t\t\t6--体育\n\t\t\t7--思修\n" );
    scanf( "%d", &choice );
    for( i = 1 ; i <= 7; i++ )
        if( choice == i ){
            for( j = 1; j <= 7 ; j++ )
                for( i = 1;i <= 10; i++)
                band[j][i] = 0;
                for( i = 1; i <= 20; i++ )
                    for( j = 1; j <= 7; j++ ){
                        if( stu[i].cj[j] <= 10 )
                            band[j][1]++;
                        else if( stu[i].cj[j] <= 20 )
                            band[j][2]++;
                        else if( stu[i].cj[j] <= 30 )
                            band[j][3]++;
                        else if( stu[i].cj[j] <= 40 )
                            band[j][4]++;
                        else if( stu[i].cj[j] <= 50 )
                            band[j][5]++;
                        else if( stu[i].cj[j] <= 60 )
                            band[j][6]++;
                        else if( stu[i].cj[j] <= 70 )
                            band[j][7]++;
                        else if( stu[i].cj[j] <= 80 )
                            band[j][8]++;
                        else if( stu[i].cj[j] <= 90 )
                            band[j][9]++;
                        else band[j][10]++;
                    }
        }
        for( j = 1; j <= 10; j++ )
            printf( "分数段在0--%d的人数有:%d\n", 10*j, band[i][j] );

}//这的逗号应该不要吧

你试试哦!
2012-12-23 22:56
青春无限
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:江苏
等 级:贵宾
威 望:24
帖 子:3452
专家分:19340
注 册:2012-3-31
收藏
得分:5 
学习

学 会看代码…学习写程序…学会搞开发…我的目标!呵呵是不是说大话啊!!一切皆可能
2012-12-23 22:56
冯jungle
Rank: 1
等 级:新手上路
帖 子:24
专家分:0
注 册:2012-12-16
收藏
得分:0 
回复 2楼 wuxia111111
谢谢了,这只是我的一部分程序,choice是定义了的
2012-12-23 23:00
快速回复:这一段程序有问题吗?求指导!!谢谢!
数据加载中...
 
   



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

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