回 帖 发 新 帖 刷新版面

主题:学生挡案管理系统原代码1-3



void XSZL::gototail()
{
    current=tail;
}

void XSZL::print()
{
    int cont=1;
    current=head;
    if(head==null)
        cout<<"\n对不起!学生档案管理库是空的,不能进行打印!!"<<endl<<endl;
    while(current!=null)
    {
        cout<<cont<<"   "<<current<<endl;
        current=current->next;
        cont++;
    }
    gotohead();
}

void XSZL::open()
{
    int i=0;
    int c=0;
    unsigned long d=0;
    FILE *fp;
    XSZLJD *ss;
    char *e;
    e=new char;
    ss=new struct XSZLJD;
    int tt=0;
    char openf[50];
    cout<<"请输入您要打开的文件名:";
    cin>>openf;
    fp=fopen(openf,"rb");
    if((fp=fopen(openf,"rb"))==null)
        cout<<"不能打开文件"<<endl;
    fread(e,sizeof(char),1,fp);
    fseek(fp,-1,1);
    while(*e!=10&&*e!=13)
    {
    i=0;
    while(1)
    {
    fread(e,sizeof(char),1,fp);
    if(*e==32)
        break;
    if(i==0)
        ss->XH=*e-48;
    else
        ss->XH=ss->XH*10+(*e-48);
    i++;
    }
    i=0;
    while(*e==32)
        fread(e,sizeof(char),1,fp);
    fseek(fp,-1,1);
    while(1)
    {
        fread(e,sizeof(char),2,fp);
        if(*e==32)
            break;
        strcpy(ss->XM+i,e);
        i++;
        i++;
    }
    ss->XM[i]=0;
    i=0;
    while(*e==32)
        fread(e,sizeof(char),1,fp);
    fseek(fp,-1,1);
    while(1)
    {
    fread(e,sizeof(char),1,fp);
    if(*e==32)
        break;
    if(i==0)
        ss->NL=*e-48;
    else
        ss->NL=ss->NL*10+(*e-48);
    i++;
    }
    i=0;
    while(*e==32)
        fread(e,sizeof(char),1,fp);
    fseek(fp,-1,1);
    while(1)
    {
        fread(e,sizeof(char),2,fp);
        if(*e==32)
            break;
        strcpy(ss->XB+i,e);
        i++;
        i++;
    }
    ss->XB[i]=0;
    i=0;
    while(*e==32)
        fread(e,sizeof(char),1,fp);
    fseek(fp,-1,1);
    while(1)
    {
        fread(e,sizeof(char),1,fp);
        if(*e==32)
            break;
        strcpy(ss->SS+i,e);
        i++;
    }
    ss->SS[i]=0;
    i=0;
    while(*e==32)
        fread(e,sizeof(char),1,fp);
    fseek(fp,-1,1);
    while(1)
    {
        fread(e,sizeof(char),2,fp);
        if(*e==32)
            break;
        strcpy(ss->BJ+i,e);
        i++;
        i++;
    }
    ss->BJ[i]=0;
    i=0;
    while(*e==32)
        fread(e,sizeof(char),1,fp);
    fseek(fp,-1,1);
    while(1)
    {
    fread(e,sizeof(char),1,fp);
    if(*e==13)
        break;
    if(i==0)
        ss->ZHCJ=*e-48;
    else
        ss->ZHCJ=ss->ZHCJ*10+(*e-48);
    i++;
    }
    i=0;
    while(*e==13)
    {
        if(i==6)
            break;
        fread(e,sizeof(char),1,fp);
        fread(e,sizeof(char),1,fp);
        i++;
    }
    fseek(fp,-1,1);
    XSZLJD *newitem;
    newitem=new XSZLJD;
    newitem->prev=null;
    newitem->next=null;
    newitem->dataptr=ss->dataptr;
    newitem->XH=ss->XH;
    strcpy(newitem->XM,ss->XM);//两个数组之间的辅值
    newitem->NL=ss->NL;
    strcpy(newitem->XB,ss->XB);//两个数组之间的辅值
    strcpy(newitem->SS,ss->SS);//两个数组之间的辅值
    strcpy(newitem->BJ,ss->BJ);//两个数组之间的辅值
    newitem->ZHCJ=ss->ZHCJ;
    if(head==null)
    {
        head=newitem;
        tail=newitem;
        current=newitem;
    }
    else
    {
        if(current==tail)
        {
            newitem->prev=current;
            newitem->next=null;
            current->next=newitem;
            tail=newitem;
            current=newitem;
        }
        else
        {
            newitem->prev=current;
            newitem->next=current->next;
            current->next->prev=newitem;
            current->next=newitem;
        }
    }
    ++count;
    tt++;
}
rewind(fp);
print();
    cout<<"导入文件中的数据个数为:"<<tt<<endl;
}

void XSZL::out()
{
    int tt=0;
    current=head;
    char stubase[50];
    cout<<"请输入您要导出文件的名称(名称.txt):";
    cin>>stubase;
    ofstream outclientFile(stubase,ios::out);
    if(!outclientFile)
    {
        cerr<<"文件不能被打开!!"<<endl;
        exit(1);
    }
    while(current!=null)
    {
        outclientFile<<current<<endl;
        current=current->next;
        tt++;
    }
    outclientFile.seekp(0);
    cout<<"导出文件中的数据的个数:"<<tt<<endl;
}

void XSZL::empty()
{
    int o,t;
    XSZLJD *temp,*hold;
    temp=new struct XSZLJD;
    hold=new struct XSZLJD;
    temp=head;
    if(temp==null)
        cout<<"\n对不起!该学生档案库已是空的,不能再进行清空!!"<<endl<<endl;
    while(temp!=null)
    {
        hold=temp->next;
        delete temp;
        temp=hold;
    }
    head=null;
    current=null;
    tail=null;
    count=0;
    cout<<"返回主界面,请输入:(1):";
    cin>>o;

}

#include <iostream.h>
#include <iomanip.h>
#include "XSZL1.H"
void main()
{
    int o,t,e,f;
    o=1;
    while(o==1)
    {
    char x;
    t=1;
    XSZL student;
    cout<<"********************************************************************************"<<endl;
    cout<<setw(46)<<"学生档案管理系统"<<endl;
    cout<<"\n********************************************************************************"<<endl;
    cout<<setw(27)<<"A:插入一个学生数据"<<setw(40)<<"B:删除一个数据项"<<endl;
    cout<<setw(27)<<"C:对数据的组合查询"<<setw(40)<<"D:对数据进行排序"<<endl;
    cout<<setw(27)<<"E:导入一个数据文件"<<setw(40)<<"F:导出全部的数据"<<endl;
    cout<<setw(27)<<"G:打印全部的数据项"<<setw(40)<<"H:清空全部的数据"<<endl;
    cout<<"\n********************************************************************************"<<endl;
    cout<<"设 计 者:***()  ***()"<<endl;
    cout<<"          ***()       ***()    ***()"<<endl;
    cout<<"指导老师:***"<<endl;
    cout<<"院    系:****"<<endl;
    cout<<"设计时间:2003年10月29日"<<endl;
    cout<<"\n********************************************************************************"<<endl;
    cout<<"******请选择要操作的项目(A,B,C,D,E,F,G,H);如果退出输入:(0)******\n";
    cin>>x;
    if(x=='A')
        while(t==1)
        {
            student.insert();
            cout<<"******是否继续进行插入,如果是请输入(1),否则输入(0)******\n";
            cin>>t;
            cout<<"******您是否要对刚插入的全部数据进行其它操作,是输入:1;不是输0******\n";
            cin>>e;
            while(e==1)
            {
                cout<<"******输入2:代表进行查询操作******\n";
                cout<<"******输入3:代表进行删除操作******\n";
                cout<<"******输入4:代表进行打印操作******\n";
                cout<<"******输入5:代表进行排序操作******\n";
                cout<<"******输入6:代表进行清空操作******\n";
                cout<<"******输入7:代表进行导出操作******\n";
                cin>>f;
                if(f==2)
                {
                    student.search();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==3)
                {
                    student.delet();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==4)
                {
                    student.print();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==5)
                {
                    student.sequence();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==6)
                {
                    student.empty();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==7)
                {
                    student.out();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
            }
        }
    else if(x=='B')
        student.delet();
    else if(x=='C')
        student.search();
    else if(x=='D')
        student.sequence();
    else if(x=='E')
    {
        student.open();
        cout<<"******您是否要对刚导入的全部数据进行其它操作,是输入:1;不是输0******\n";
        cin>>e;
        while(e==1)
            {
                cout<<"******输入2:代表进行查询操作******\n";
                cout<<"******输入3:代表进行删除操作******\n";
                cout<<"******输入4:代表进行打印操作******\n";
                cout<<"******输入5:代表进行排序操作******\n";
                cout<<"******输入6:代表进行清空操作******\n";
                cout<<"******输入7:代表进行导出操作******\n";
                cout<<"******输入8:代表进行插入操作******\n";
                cin>>f;
                if(f==2)
                {
                    student.search();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==3)
                {
                    student.delet();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==4)
                {
                    student.print();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==5)
                {
                    student.sequence();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==6)
                {
                    student.empty();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==7)
                {
                    student.out();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
                else if(f==8)
                {
                    student.insert();
                    cout<<"******返回请输入(0),继续操作输入(1)******\n";
                    cin>>e;
                }
            }
    }
    else if(x=='F')
        student.out();
    else if(x=='G')
        student.print();
    else if(x=='H')
        student.empty();
    else if(x=='0')
        break;
    }
}

请大家给建议,谢谢………………

回复列表 (共4个回复)

沙发

7323652

板凳

头文件的定义呢
error C2653: 'XSZL' : is not a class or namespace name

3 楼

顶!

4 楼

上海市北双线机房|市北机房|双线双IP市北机房,服务器托管,13774348120王永亮
=============================================================

 更 多 详 情 请 咨 询 :

 咨询热线:021-62166977-28 在线手机咨询: 13774348120 王永亮 

网络在线咨询方式:MSN:wyl@datasupermarket.com    QQ:541449939

公司地址:上海市普陀区兰溪路10弄3号楼1901室(三汽公司附近)

上海移动怒江ARP防护区,机柜租用,ARP防护区服务器托管1U4600元/年。13774348120王永亮
上海市北双线机房|市北机房|双线双IP市北机房,服务器托管,13774348120王永亮

我来回复

您尚未登录,请登录后再回复。点此登录或注册