| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 252 人关注过本帖
标题:学生试卷分数统计系统 不能运行 求更正
只看楼主 加入收藏
天天向上1011
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-6-15
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
学生试卷分数统计系统 不能运行 求更正
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<math.h>
#define SIZE 300
typedef struct student
{
    int number;
    int score[3];
}
STUDENT;
typedef enum boolen
{
    False,Ture
}
FALG;
int accept_data(STUDENT stu[],int grade[]);
void show_data(STUDENT stu[],int sum,int grade[]);
void count(int *max,int *min,double *pass,double ave[],double f[],STUDENT stu[],int sum);
void show_data2(int max,int min,double pass,double ave[],double f[]);
int main()
{
    int sum,max,min;
    double pass=0;
    int grade[11]={0};
    STUDENT stu[SIZE];
    double ave[SIZE],f[SIZE];
    sum=accept_data(stu,grade);
    show_data(stu,sum,grade);
    count(&max,&min,&pass,ave,f,stu,sum);
    show_data2(max,min,pass,ave,f);
    return 0;
    }
    int accept_data(STUDENT stu[],int grade[])
    {
        int i=0,sum=0,temp,a1,a2;
        FLAG flag;
        printf("\n 请输入总评成绩中平时成绩与期末卷面的比例,用整数表示");
        scanf("%d%d",&a1,&a2);
        while(i<SIZE)
        {
            printf("\n 请输入学号:");
            scanf("%d",&stu[i].number);
            if(stu[i].number==-1)
            {
                sum=i;
                break;
            }
            printf("请输入学生的平时成绩和期末卷面:");
            flag=True;
            while(flag==True)
            {
                scanf("%d%d",&stu[i].score[0],&stu[i].score[i]);
                if(stu[i].score[0]<=100&&stu[i].score[0]>=0&&\
                   stu[i].score[1]<100&&stu[i].score[1]>=0)
                   flag=False;
                   else
                   printf("\n\007数据错误!请重新输入学生的平时成绩和期末卷面:");   
                }
            temp=(int)(1.0*a1/100*stu[i].score[0]+1.0*a2/100* stu[i].score[1]);
            stu[i].score[2]=temp;
            temp=(stu[i].score[1])/10;
            if(temp==10)
             grade[10]++;
            else
             grade[temp+1]++;
             i++;
               }
               return sum;
        }
        void show_data(STUDENT STU[],int sum,int grade[])
        {
            int i,j;
            for(i=0;i<sum;i++)
            {
                printf("%4d",stu[i].number);
                for(j=0;j<3;j++)
                printf("%4d",stu[i].score[j]);
                printf("\n");
            }
        for(i=1;i<=10;i++)
          printf("%d",grade[i]);
          }
          void count(int *max,int *min,double pass,double ave[],double f[],STUDENT stu[],int sum)
          {
              int i,j,p_sum=0;
              int total[3];
              double temp;
              *max=*min=stu[0].score[1];
            if(stu[0].score[1]>=60)
            p_sum++;
           for(i1;i<sum;i++)
           {
               if((stu[i].score[1])>*max)
                  *min=stu[i].score[1];
               if(stu[i].score[1]>=60)
               p_sum++;
           }
           *pass=(1.0*p_sum/sum)*100;
           for(i=0;i<sum;i++)
             total[i]=0;
           for(j=0;j<3;j++)
            for(i+0;i<sum;i++)
            {
                total[j]=total[j]+stu[i].score[j];
            }     
            for(j=0;j<3;j++)
            {
                ave[j]=total[j]/sum;
                }
            for(j=0;j<3;j++)
            {
                f[j]=0;
                for(i=0;i<sum;i++)
                {
                    temp=stu[i].score[j]-sve[j];
                    f[j]=f[j]+temp*temp;
                }
                f[j]=sqrt(fabs(f[j])/sum);
            }   
            }   
            void show_data2(int max,int min,double pass,double ave[],doublef[])
            {   
                int j;
                char str1[3][20]={"平时成绩平均分","期末卷面平均分","总评成绩平均分"};
                char str2[3][20]={"平时成绩标准差","期末卷面标准差","总评成绩标准差"};
                printf("\n 及格率=%6.2f %%最高分=%d 最低分=%d\n",pass,max,min);
                for(j=0;j<3;j++)
                printf("\n %s=%6.2f %s=%6.2f\n",str[j],ave[j],str2[j],f[j]);
            }
            
             }
            
            
搜索更多相关主题的帖子: 统计 
2011-06-15 00:30
laoyang103
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:内蒙古包头
等 级:贵宾
威 望:19
帖 子:3082
专家分:11056
注 册:2010-5-22
收藏
得分:20 
..........你把代码粘全了吗  我怎么感觉底下少了好多花括号

                                         
===========深入<----------------->浅出============
2011-06-15 09:41
快速回复:学生试卷分数统计系统 不能运行 求更正
数据加载中...
 
   



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

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