| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3879 人关注过本帖
标题:谁能帮我看看,为什么elemtype会没有的定义?
只看楼主 加入收藏
ice_callous
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2010-10-14
结帖率:60%
收藏
已结贴  问题点数:20 回复次数:3 
谁能帮我看看,为什么elemtype会没有的定义?
#define OK 1
#define null 0
#define error 0
#define OVERFLOW 0
#define LIST_INTT_SIZE 10000
#define LISTINCREMENT 10   
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
struct student
{
    char  name[20];
    long int  number;
    int   age;
    float score;
    float Chinese;
    float math;
    float English;
};
typedef int status;
typedef student elemtype;



typedef struct
{
    elemtype *elem;
    int length;
    int  listsize;
}sqlist;






status initlist_sq(sqlist &L)
{
    L.elem=(elemtype*)malloc(1000*sizeof(elemtype));
    if(!L.elem)
        exit(OVERFLOW);
    L.length=0;
    L.listsize=LIST_INTT_SIZE;
    return OK;
}


void datain_sq(sqlist &L)
{
    int i;
    /*int n;
    printf("请输入读入学生的个数:\n");
    scanf("%d",&n);*/
    for(i=0;i<3;i++)
    {
        scanf("%s%ld%d%f%f%f%f",L.elem[i].name,&L.elem[i].number,&L.elem[i].age,&L.elem[i].score,&L.elem[i].Chinese,&L.elem[i].math,&L.elem[i].English);
        L.length++;
    }
   
}


status dataout_sq(sqlist &L)
{
    int i;
    for(i=0;i<L.length;i++)
        printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
     return OK;
}





status listinsert_sq(sqlist &L, int i,elemtype &e)   //在顺序表第i个位置插入学生数据
{
    elemtype *p,*q;
    if(i<=0||i>L.length)
    {
        printf("插入位置错误\n");
        return OK;
    }
    q=&(L.elem[i-1]);
    for(p=&(L.elem[L.length-1]);p>=q;p--)
        *(p+1)=*p;
    *q=e;
    ++L.length;
    return OK;
}




status listdelete_sq(sqlist &L,long int b,elemtype &e)//按学生学号删除学生数据
{
    elemtype *p,*q;
    int i,count=0;
    for(i=0;i<=L.length-1;i++)
    {
        if(L.elem[i].number==b)
        {
                count++;
                 break;
        }
   
    }
    if(count==1)
    {
        p=&(L.elem[i]);
        e=*p;
        q=L.elem+L.length-1;
        for(p++;p<=q;p++)
        *(p-1)=*p;
        L.length--;
    }
    if(count==0)
        printf("没有该生的信息\n");
    return count;
}




void search_name(sqlist &L,char *stu)
{
   int i;
   int n=0;
    for(i=0;i<=L.length;i++)
    if(!strcmp(L.elem[i].name,stu))
    {
        n++;
        if(n==1)
            printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
            printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
    }
            if(n==0)
                printf("没有找到相关数据\n");
}





void search_age(sqlist &L,int key)
{
    int i;
    for(i=0;i<L.length;i++)
    {
        int n=0;
        if(L.elem[i].age==key)
        {
            n++;
            if(n==1)
            {
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }   
}





void search_agerange(sqlist &L,int low,int up)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].age<=up&&L.elem[i].age>=low)
        {
            n++;
            if(n==1)
            {
                printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}








void search_score(sqlist &L,float key)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].score==key)
        {
            n++;
            if(n==1)
            {
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
            if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}




void search_scorerange(sqlist &L,float low,float up)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].score<=up&&L.elem[i].score>=low)
        {
            
            if(n==1)
            {
               
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}






void search_Chinese(sqlist &L,float key)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].Chinese==key)
        {
            n++;
            if(n==1)
            {
               
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}




void search_Chineserange(sqlist &L,float low,float up)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].Chinese<=up&&L.elem[i].Chinese>=low)
        {
            n++;
            if(n==1)
            {
               
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}




void search_math(sqlist &L,float key)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].math==key)
        {
            n++;
            if(n==1)
            {
               
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}




void search_mathrange(sqlist &L,float low,float up)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].math<=up&&L.elem[i].math>=low)
        {
            n++;
            if(n==1)
            {
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);   
            }
            if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}


void search_English(sqlist &L,float key)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].English==key)
        {
            n++;
            if(n==1)
            {
               
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}




void search_Englishrange(sqlist &L,float low,float up)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].English<=up&&L.elem[i].English>=low)
        {
            n++;
            if(n==1)
            {
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}




void search_number(sqlist &L,long int key)
{
   int i;
    for(i=0;i<=L.length;i++)
    {
        int n=0;
        if(L.elem[i].number==key)
        {
            n++;
            if(n==1)
            {
                    printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
                printf("%s\t%ld\t%d\t%.2f\t%.2f\t%.2f\t%.2f\n",L.elem[i].name, L.elem[i].number,L.elem[i].age,L.elem[i].score,L.elem[i].Chinese,L.elem[i].math,L.elem[i].English);
            }
                if(n==0)
                printf("没有找到相关数据\n");
        }
    }
}



status insertsort_number_sq(sqlist &L)         //学生学号用插入方法排序
{
    elemtype temp;
    int i,j;
    for(i=1;i<L.length;i++)
   
        if(L.elem[i].number<L.elem[i-1].number)
        {
            temp=L.elem[i];
            L.elem[i]=L.elem[i-1];
            for(j=i-1;j>=0&&temp.number<L.elem[j].number;j--)
                L.elem[j+1]=L.elem[j];
            L.elem[j+1]=temp;
        }
    return OK;
}




status insertsort_age_sq(sqlist &L)         //学生年龄用插入方法排序
{
    elemtype temp;
    int i,j;
    for(i=1;i<L.length;i++)
   
        if(L.elem[i].age<L.elem[i-1].age)
        {
            temp=L.elem[i];
            L.elem[i]=L.elem[i-1];
            for(j=i-1;j>=0&&temp.age<L.elem[j].age;j--)
                L.elem[j+1]=L.elem[j];
            L.elem[j+1]=temp;
        }
    return OK;
}




status partition_math_sq(sqlist &L,int low,int high)   //交换顺序表L中子表L.r[low...high]的记录,使枢轴记录到位,并返回其所在位置,此时在它之前(后)的记录均不大(小)于它
{
    float pivokey;
    elemtype temp;
    pivokey=L.elem[low].math;                  //用子表的第一个记录作枢轴记录
    while(low<high)
    {
        while(low<high&&L.elem[high].math>=pivokey)
            high--;
        temp=L.elem[low];
        L.elem[low]=L.elem[high];
        L.elem[high]=temp;
        while(low<high&&L.elem[low].math<=pivokey)
            low++;
        temp=L.elem[low];
        L.elem[low]=L.elem[high];
        L.elem[high]=temp;
    }
    return low;
}


status Qsort_math_sq(sqlist &L,int low,int high)
{
    int pivotloc;
    if(low<high)
    {
        pivotloc=partition_math_sq(L,low,high);
        Qsort_math_sq(L,low,pivotloc-1);
        Qsort_math_sq(L,pivotloc+1,high);
    }
    return OK;
}


status Quicksort_math_sq(sqlist &L)
{
    Qsort_math_sq(L,0,L.length-1);
    return OK;
}





status partition_English_sq(sqlist &L,int low,int high)
{
    float pivokey;
    elemtype temp;
    pivokey=L.elem[low].English;
    while(low<high)
    {
        while(low<high&&L.elem[high].English>=pivokey)
            high--;
        temp=L.elem[low];
        L.elem[low]=L.elem[high];
        L.elem[high]=temp;
        while(low<high&&L.elem[low].English<=pivokey)
            low++;
        temp=L.elem[low];
        L.elem[low]=L.elem[high];
        L.elem[high]=temp;
    }
    return low;
}


status Qsort_English_sq(sqlist &L,int low,int high)
{
    int pivotloc;
    if(low<high)
    {
        pivotloc=partition_English_sq(L,low,high);
        Qsort_English_sq(L,low,pivotloc-1);
        Qsort_English_sq(L,pivotloc+1,high);
    }
    return OK;
}


status Quicksort_English_sq(sqlist &L)
{
    Qsort_English_sq(L,0,L.length-1);
    return OK;
}




status partition_Chinese_sq(sqlist &L,int low,int high)
{
    float pivokey;
    elemtype temp;
    pivokey=L.elem[low].Chinese;
    while(low<high)
    {
        while(low<high&&L.elem[high].Chinese>=pivokey)
            high--;
        temp=L.elem[low];
        L.elem[low]=L.elem[high];
        L.elem[high]=temp;
        while(low<high&&L.elem[low].Chinese<=pivokey)
            low++;
        temp=L.elem[low];
        L.elem[low]=L.elem[high];
        L.elem[high]=temp;
    }
    return low;
}


status Qsort_Chinese_sq(sqlist &L,int low,int high)
{
    int pivotloc;
    if(low<high)
    {
        pivotloc=partition_Chinese_sq(L,low,high);
        Qsort_Chinese_sq(L,low,pivotloc-1);
        Qsort_Chinese_sq(L,pivotloc+1,high);
    }
    return OK;
}


status Quicksort_Chinese_sq(sqlist &L)
{
    Qsort_Chinese_sq(L,0,L.length-1);
    return OK;
}





status partition_score_sq(sqlist &L,int low,int high)
{
    float pivokey;
    elemtype temp;
    pivokey=L.elem[low].score;
    while(low<high)
    {
        while(low<high&&L.elem[high].score>=pivokey)
            high--;
        temp=L.elem[low];
        L.elem[low]=L.elem[high];
        L.elem[high]=temp;
        while(low<high&&L.elem[low].score<=pivokey)
            low++;
        temp=L.elem[low];
        L.elem[low]=L.elem[high];
        L.elem[high]=temp;
    }
    return low;
}


status Qsort_score_sq(sqlist &L,int low,int high)
{
    int pivotloc;
    if(low<high)
    {
        pivotloc=partition_score_sq(L,low,high);
        Qsort_score_sq(L,low,pivotloc-1);
        Qsort_score_sq(L,pivotloc+1,high);
    }
    return OK;
}




status Quicksort_score_sq(sqlist &L)
{
    Qsort_score_sq(L,0,L.length-1);
    return OK;
}




float lowscore_sq(sqlist &L)
{
    int i;
    float low;
    low=L.elem[0].score;
    for(i=0;i<L.length;i++)
    {
        if(low>L.elem[i].score)
            low=L.elem[i].score;
    }
    return low;
}



float highscore_sq(sqlist &L)
{
    int i;
    float high;
    high=L.elem[0].score;
    for(i=0;i<L.length;i++)
    {
        if(high<L.elem[i].score)   
            high=L.elem[i].score;
    }
    return high;
}




float lowChinese_sq(sqlist &L)
{
    int i;
    float low;
    low=L.elem[0].Chinese;
    for(i=0;i<L.length;i++)
    {
        if(low>L.elem[i].Chinese)
            low=L.elem[i].Chinese;
    }
    return low;
}





float highChinese_sq(sqlist &L)
{
    int i;
    float high;
    high=L.elem[0].Chinese;
    for(i=0;i<L.length;i++)
    {
        if(high<L.elem[i].Chinese)
        high=L.elem[i].Chinese;
    }
    return high;
}




float lowmath_sq(sqlist &L)
{
    int i;
    float low;
    low=L.elem[0].math;
    for(i=0;i<L.length;i++)
    {
        if(low>L.elem[i].math)
        low=L.elem[i].math;
    }
    return low;
}





float highmath_sq(sqlist &L)
{
    int i;
    float high;
    high=L.elem[0].math;
    for(i=0;i<L.length;i++)
    {
        if(high<L.elem[i].math)
        high=L.elem[i].math;
    }
    return high;
}




float lowEnglish_sq(sqlist &L)
{
    int i;
    float low;
    low=L.elem[0].English;
    for(i=0;i<L.length;i++)
    {
        if(low>L.elem[i].English)
        low=L.elem[i].English;
    }
    return low;
}





float highEnglish_sq(sqlist &L)
{
    int i;
    float high;
    high=L.elem[0].English;
    for(i=0;i<L.length;i++)
    {
        if(high<L.elem[i].English)
        high=L.elem[i].English;
    }
    return high;
}




int lowage_sq(sqlist &L)
{
    int i;
    int low;
    low=L.elem[0].age;
    for(i=0;i<L.length;i++)
    {
        if(low>L.elem[i].age)
        low=L.elem[i].age;
    }
    return low;
}





int highage_sq(sqlist &L)
{
    int i;
    int high;
    high=L.elem[0].age;
    for(i=0;i<L.length;i++)
    {
        if(high<L.elem[i].age)
        high=L.elem[i].age;
    }
    return high;
}
搜索更多相关主题的帖子: elemtype 定义 
2010-10-18 21:37
ice_callous
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2010-10-14
收藏
得分:0 
回复 楼主 ice_callous
论坛限制了字数,现在把主函数补上...
void main()
{
    sqlist myL;
    initlist_sq(myL);
    int x,y,z,w,p,q;
    int j1,j2,j3;
    int i;
    char j4[20];
    long int j5;
    long int a;
    long int b;
    float k;
    float t1,t2,t3,t4,t5,t6,t7,t8;
    student temp1;
    student temp2;
    int max;
    max=-32767;
    printf("主界面\n");
    printf("********************************************************\n");
    printf("*               学生成绩管理系统                       *\n");
    printf("*                                    作者:刘梦歆       *\n");
    printf("*     1.读入数据      2.打印数据      3.插入数据       *\n");
    printf("*     4.删除数据      5.查询          6.排序           *\n");
    printf("*     7.求最值        8.退出                           *\n");
    printf("********************************************************\n");
a:printf("请输入你的选择:\n");
  scanf("%d",&x);
  switch(x)
  {
    case 1:printf("请向顺序表中读入数据:\n");
        printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
         datain_sq(myL);
         break;
    case 2:printf("顺序表中的数据为:\n");
         dataout_sq(myL);
         break;
    case 3:printf("请输入插入位置和信息\n");
         printf("插入位置为:\n");
         scanf("%d",&a);
         printf("插入信息为:\n");
         printf("姓名\t学号\t年龄\t总分\t语文\t数学\t英语\n");
         scanf("%s%ld%d%f%f%f%f",temp1.name,&temp1.number,&temp1.age,&temp1.score,&temp1.Chinese,&temp1.math,&temp1.English);
         listinsert_sq(myL,a,temp1);
         printf("请输出插入数据后,顺序表为:\n");
          dataout_sq(myL);
         break;
    case 4:printf("请输入删除要删除的学生的学号:\n");
         scanf("%d",&b);
         listdelete_sq(myL,b,temp2);
         printf("删除的学生的信息为:%s\t%ld\t%d\t%f\t%f\t%f\t%f\n",temp2.name,temp2.number,temp2.age,temp2.score,temp2.Chinese,temp2.math,temp2.English);
         printf("删除后的顺序表为:\n");
         dataout_sq(myL);
         break;
    case 5:printf("查询界面\n");
         printf ("*******************************************************\n");
         printf ("*    1.按成绩查询    2.按成绩段查询   3.按年龄查询    *\n");
         printf ("*    4.按年龄段查询  5.按姓名查询     6.按学号查询    *\n");
         printf ("*    7.返回到学生成绩管理主界面                       *\n");
         printf ("*******************************************************\n");
    b:printf("请输入你的选择:\n");
        scanf("%d",&y);
        switch(y)
        {
            case 1:printf("成绩查询界面\n");
                printf ("*********************************************************\n");
                printf ("*        1.按语文成绩查询       2.按数学成绩查询        *\n");
                printf ("*        3.按英语成绩查询       4.按入学总分查询        *\n");
                printf ("*        5.返回到查询界面                               *\n");
                printf ("*********************************************************\n");
        c:printf("请输入你的选择:\n");
            scanf("%d",&z);
            switch(z)
            {
               
                    case 1:printf("请输入查询的语文成绩:\n");
                        scanf("%f",&k);
                        printf("按语文成绩查找的结果为:\n");
                        search_Chinese(myL,k);
                        break;
                    case 2:printf("请输入查询的数学成绩:\n");
                        scanf("%f",&k);
                        printf("按数学成绩查找的结果为:\n");
                        search_math(myL,k);
                        break;
                    case 3:printf("请输入查询的英语成绩:\n");
                        scanf("%f",&k);
                        printf("按英语成绩查找的结果为:\n");
                        search_English(myL,k);
                        break;
                    case 4:printf("请输入查询的入学总分:\n");
                        scanf("%f",&k);
                        printf("按入学总分查找的结果为:\n");
                        search_score(myL,k);
                        break;
                    case 5:printf("返回到查询界面!\n");
                        printf("查询界面\n");
                        printf ("*******************************************************\n");
                        printf ("*    1.按成绩查询    2.按成绩段查询   3.按年龄查询    *\n");
                        printf ("*    4.按年龄段查询  5.按姓名查询     6.按学号查询    *\n");
                        printf ("*    7.返回到学生成绩管理主界面                       *\n");
                        printf ("*******************************************************\n");
                        goto b;
                        break;
                    default :printf("error");
                }
                goto c;
                break;
            
        case 2:printf ("成绩段查询界面\n");
            printf ("*********************************************************\n");
            printf ("*      1.按语文成绩段查询      2.按数学成绩段查询       *\n");
            printf ("*      3.按英语成绩段查询      4.按入学总分的成绩段查询 *\n");
            printf ("*      5.返回到查询界面                                 *\n");
            printf ("*********************************************************\n");
        d:printf("请输入你的选择:\n");
            scanf("%d",&w);
            switch(w)
            {
               
                    case 1:printf("请分别输入你要查找的学生语文成绩的下限和上限:\n");
                             scanf("%f%f",&t1,&t2);
                             search_Chineserange(myL,t1,t2);
                             break;
                    case 2:printf("请分别输入你要查找的学生数学成绩的下限和上限:\n");
                             scanf("%f%f",&t3,&t4);
                             search_mathrange(myL,t3,t4);
                             break;
                    case 3:printf("请分别输入你要查找的学生英语成绩的下限和上限:\n");
                             scanf("%f%f",&t5,&t6);
                             search_Englishrange(myL,t5,t6);
                             break;
                    case 4:printf("请分别输入你要查找的学生入学总分的下限和上限:\n");
                             scanf("%f%f",&t7,&t8);
                             search_scorerange(myL,t7,t8);
                             break;
                    case 5:printf("返回到查询界面!\n");
                        printf("查询界面\n");
                        printf ("*******************************************************\n");
                        printf ("*    1.按成绩查询    2.按成绩段查询   3.按年龄查询    *\n");
                        printf ("*    4.按年龄段查询  5.按姓名查询     6.按学号查询    *\n");
                        printf ("*    7.返回到学生成绩管理主界面                       *\n");
                        printf ("*******************************************************\n");
                                goto b;
                                break;
                        default :printf("error\n");
                    }
                goto d;
                break;
        case 3:printf("请输入你要查询的学生的年龄:\n");
            scanf("%d",&j1);
            search_age(myL,j1);
            break;
        case 4:printf("请输入你要查询的学生的年龄的下限和上限:\n");
            scanf("%d%d",&j2,&j3);
            search_agerange(myL,j2,j3);
            break;
        case 5:printf("请输入你要查询的学生的姓名:\n");
            scanf("%s",j4);
            search_name(myL,j4);
        case 6:printf("请输入你要查询的学生的学号:\n");
            scanf("%ld",&j5);
            search_number(myL,j5);
            break;
        case 7:printf("返回到学生成绩管理主界面!\n");
            printf("主界面\n");
            printf("********************************************************\n");
            printf("*               学生成绩管理系统                       *\n");
            printf("*                                    作者:刘梦歆       *\n");
            printf("*     1.读入数据      2.打印数据      3.插入数据       *\n");
            printf("*     4.删除数据      5.查询          6.排序           *\n");
            printf("*     7.求最值        8.退出                           *\n");
            printf("********************************************************\n");
            goto a;
            break;
        }
        goto b;
        break;
    case 6:printf ("排序查询界面\n");
        printf ("***********************************************************\n");
        printf ("*     1.按年龄排序    2.按入学总分排序  3.按学号排序      *\n");
        printf ("*     4.按语文成绩排序       5.按数学成绩排序             *\n");
        printf ("*     6.按英语成绩排序   7.返回到学生成绩管理主界面       *\n");
        printf ("***********************************************************\n");
e:printf("请输入你的选择:\n");
            scanf("%d",&q);
            switch(q)
            {
               
               case 1:insertsort_age_sq(myL);
                      printf("请输出按学生年龄排序后的顺序表为:\n");
                      dataout_sq(myL);
                      break;
               case 2:Quicksort_score_sq(myL);
                      printf("请输出按学生入学总分排序后的顺序表为:\n");
                      dataout_sq(myL);
                      break;
               case 3:insertsort_number_sq(myL);
                      printf("请输出按学生学号排序后的顺序表为:\n");
                      dataout_sq(myL);
                      break;
               case 4:Quicksort_Chinese_sq(myL);
                      printf("请输出按语文成绩排序后的顺序表为:\n");
                      dataout_sq(myL);
                      break;
               case 5:Quicksort_math_sq(myL);
                      printf("请输出按数学成绩排序后的顺序表为:\n");
                      dataout_sq(myL);
                      break;
               case 6:Quicksort_English_sq(myL);
                      printf("请输出按英语成绩排序后的顺序表为:\n");
                      dataout_sq(myL);
                      break;
               case 7:printf("回到学生成绩管理主界面!");
                   printf("主界面\n");
                printf("********************************************************\n");
                printf("*               学生成绩管理系统                       *\n");
                printf("*                                    作者:刘梦歆       *\n");
                printf("*     1.读入数据      2.打印数据      3.插入数据       *\n");
                printf("*     4.删除数据      5.查询          6.排序           *\n");
                printf("*     7.求最值        8.退出                           *\n");
                printf("********************************************************\n");
                      goto a;
                      break;
               default:printf("输入错误!\n");
                }
                goto e;
                break;
    case 7:printf ("求最值界面\n");
        printf ("**********************************************************\n");
        printf ("*   1.入学总分最高    2.入学总分最低     3.年龄最大      *\n");
        printf ("*   4.年龄最小     5.语文成绩最低     6.语文成绩最高     *\n");
        printf ("*   7.数学成绩最高   8.数学成绩最低      9.英语成绩最高  *\n");
        printf ("*   10.英语成绩最低         11.回到主界面                *\n");
        printf ("**********************************************************\n");
f:printf("请输入你的选择:\n");
            scanf("%d",&p);
            switch(p)
            {
                      case 1:printf("当前顺序表中总分最高为:\n");
                          printf("%f",highscore_sq(myL));
                          break;
                      case 2:printf("当前顺序表中总分最低为:\n");
                          printf("%f",lowscore_sq(myL));
                          break;
                      case 3:printf("当前顺序表中年龄最大为:\n");
                          printf("%d",highage_sq(myL));
                          break;
                      case 4:printf("当前顺序表中年龄最小为:\n");
                          printf("%d",lowage_sq(myL));
                          break;
                      case 5:printf("当前顺序表中语文成绩最高为:\n");
                          printf("%f",highChinese_sq(myL));
                          break;
                      case 6:printf("当前顺序表中语文成绩最低为:\n");
                          printf("%f",lowChinese_sq(myL));
                          break;
                      case 7:printf("当前顺序表中数学成绩最高为:\n");
                          printf("%f",highmath_sq(myL));
                          break;
                      case 8:printf("当前顺序表中数学成绩最低为:\n");
                          printf("%f",lowmath_sq(myL));
                          break;
                      case 9:printf("当前顺序表中英语成绩最高为:\n");
                          printf("%f",highEnglish_sq(myL));
                          break;
                      case 10:printf("当前顺序表中英语成绩最低为:\n");
                          printf("%f",lowEnglish_sq(myL));
                          break;
                      case 11:printf("\n回到主界面!\n");
                        printf("主界面\n");
                        printf("********************************************************\n");
                        printf("*               学生成绩管理系统                       *\n");
                        printf("*                                    作者:刘梦歆       *\n");
                        printf("*     1.读入数据      2.打印数据      3.插入数据       *\n");
                        printf("*     4.删除数据      5.查询          6.排序           *\n");
                        printf("*     7.求最值        8.退出                           *\n");
                        printf("********************************************************\n");
                              goto a;
                              break;
                      default:printf("\n输入错误!\n");
                }
                goto f;
                break;
    case 8:printf("已退出!\n");
        exit(0);
    default:printf("error");
        printf("输入错误");
    }
  goto a;
}

2010-10-18 21:38
寒风中的细雨
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:66
帖 子:1710
专家分:8645
注 册:2009-9-15
收藏
得分:20 
图片附件: 游客没有浏览图片的权限,请 登录注册

没报错
图片附件: 游客没有浏览图片的权限,请 登录注册
2010-10-18 22:49
ice_callous
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2010-10-14
收藏
得分:0 
回复 3楼 寒风中的细雨
- -现在才发现是C++有问题,不过还是很感谢
2010-10-19 15:49
快速回复:谁能帮我看看,为什么elemtype会没有的定义?
数据加载中...
 
   



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

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