回 帖 发 新 帖 刷新版面

主题:[原创]学生信息管理(c)---绝对原创(4)

void seleteSearch(int num)
{
    char searchChar[20];
    int searchInt;
    show(4);
    if(num==2)cprintf("No:");
    else      cprintf("Name:");
    gets(searchChar);
    if(num==2)
    {    searchInt=atoi(searchChar);    }
    nCurrent=nHead;
    if(nHead==NULL)
    {
        textbackground(3);
        window(20,10,50,13);
        clrscr();
        window(1,23,80,25);
        gotoxy(1,1);
        clreol();
        textcolor(15);
        clreol();
        cprintf(" File Is Empty!");
        return;
    }
    textbackground(3);
    window(20,10,50,13);
    clrscr();
    puttext(1,3,80,21,buf3);
    window(1,23,80,25);
    gotoxy(1,1);
    textcolor(15);
    clreol();
    do
    {
        if(num==2&&nCurrent->stuNo==searchInt)
        {
            gotoxy(2,1);cprintf("%d",nCurrent->stuNo);
            gotoxy(11,1);cprintf("%s",nCurrent->stuName);
            gotoxy(26,1);cprintf("%c",nCurrent->stuSex);
            gotoxy(37,1);cprintf("%f",nCurrent->stuMaths);
            gotoxy(50,1);cprintf("%f",nCurrent->stuChinese);
            gotoxy(65,1);cprintf("%f",nCurrent->stuEnglish);
            return;
        }
        if(num==3&&strcmp(nCurrent->stuName,searchChar)==0)
        {
            gotoxy(2,1);cprintf("%d",nCurrent->stuNo);
            gotoxy(11,1);cprintf("%s",nCurrent->stuName);
            gotoxy(26,1);cprintf("%c",nCurrent->stuSex);
            gotoxy(37,1);cprintf("%f",nCurrent->stuMaths);
            gotoxy(50,1);cprintf("%f",nCurrent->stuChinese);
            gotoxy(65,1);cprintf("%f",nCurrent->stuEnglish);
            return;
        }
        nCurrent=nCurrent->next;
    }while(nCurrent!=NULL);
    gotoxy(1,1);
    clreol();
    cprintf(" Data Search Complete!");
}

void seleteEditOperation(int num,int line)
{
    switch(num)
    {
        case 1:seleteSearch(line);break;
        case 2:seleteTall(line);break;
        case 3:seleteDelete(line);break;
        default:break;
    }
}

void showOperation(int num,char *operation[])
{
    int key,i,cLine,line=2;
    textbackground(3);
    window(1,3,80,14);
    clrscr();
    textcolor(0);
    puttext(1,3,80,21,buf3);
    if(num==1)     {window(23,5,38,8);cLine=6;    }
    else if(num==2) {window(23,6,38,12);cLine=9;    }
    else        {window(23,7,38,10);cLine=6;    }
    textbackground(15);
    textcolor(0);
    clrscr();
    if(num==1)     {window(23,5,38,9);box(1,1,4,16);}
    else if(num==2) {window(23,6,38,13);box(1,1,7,16);}
    else        {window(23,7,38,11);box(1,1,4,16);}
    for(i=4;i<cLine;i++)
    {
        gotoxy(2,i-2);
        cprintf("%s",operation[i-4]);
    }
    textbackground(0);
    textcolor(15);
    gotoxy(2,2);
    cprintf("%s",operation[0]);
    key=bioskey(0);
    while(key!=KEY_ALT_X&&key!=KEY_ENTER&&key!=KEY_ESC)
    {
        if(key==KEY_UP||key==KEY_DOWN);
        {
            textbackground(15);
            textcolor(0);
            gotoxy(2,line);
            cprintf("%s",operation[line-2]);
            if(num==1||num==3)
            {
                if(line==2)    line=3;
                else        line=2;
            }
            if(num==2)
            {
                if(key==KEY_UP)line=line==2?6:line-1;
                if(key==KEY_DOWN)line=line==6?2:line+1;
            }
            gotoxy(2,line);
            textbackground(0);
            textcolor(15);
            cprintf("%s",operation[line-2]);
        }
        key=bioskey(0);
    }
    if(key==KEY_ENTER)
    {
        textbackground(3);
        window(23,5,38,8);
        seleteEditOperation(num,line);
    }
    else
    {
        textbackground(3);
        window(23,5,38,12);
        clrscr();
        puttext(1,3,80,21,buf3);
        return;
    }
}

void quitSure(void)
{
    int key;
    textbackground(3);
    window(1,3,15,10);
    textcolor(15);
    window(10,10,60,13);
    box(1,1,3,51);
    gotoxy(2,2);
    cprintf("Are you sure to quit?ESC to Quit,ENTER to Return.");
    key=bioskey(0);
    if(key==KEY_ESC)
    {    exit(0);        }
    if(key==KEY_ENTER)
    {
        textbackground(3);
        clrscr();
        window(1,3,80,20);
        puttext(1,3,80,21,buf3);
        return;            
    }
}

void seleteOperation(int numx,int numy)
{
    if(numx==0)
    {    
        switch(numy-4)
        {
            case 0:openFile();break;
            case 1:new();break;
            case 2:save();break;
            case 3:saveTo();break;
            case 4:quitSure();
            default:break;
        }
        return;
    }
    if(numx==8)
    {
        switch(numy-4)
        {
            case 0:insert();break;
            case 1:showOperation(1,s);break;
            case 2:showOperation(2,t);break;
            case 3:showOperation(3,d);break;
            case 4:seleteAll();break;
            default:break;
        }
        return;
    }
}

void showTitle(void)
{
    int i,x,y,l;
    textbackground(3);
    clrscr();
    window(1,1,80,1);
    textbackground(5);
    textcolor(15);
    window(1,1,80,2);
    gotoxy(1,1);
    cprintf("                      Student's Record Management System                        ");
    textbackground(2);
    clreol();
    window(1,2,80,2);
    gotoxy(2,1);
    for(i=0,l=0;i<3;i++)
    {
        x=wherex();y=wherey();
        cprintf("%s",menu[i]);
        l=strlen(menu[i]);
        gotoxy(x,y);
        textcolor(4);
        cprintf("%s",red[i]);
        x=x+l+4;
        gotoxy(x,y);
        textcolor(15);
    }
    gettext(2+menuLine*8,2,9+menuLine*8,2,buf2);
    textbackground(0);
    textcolor(15);
    gotoxy(2,1);
    cprintf("%s",menu[0]);
    textbackground(3);
    window(1,3,80,24);
    gotoxy(1,20);
    for(i=0;i<80;i++)
    {    putch(0xc4);    }
    gotoxy(35,20);
    cprintf(" Message ");
    gotoxy(1,1);
}

回复列表 (共3个回复)

沙发

我的头都要炸了!

板凳

要是有注释就好了,看起来很累哦!!
不过还是很厉害啊!!
顶!!!!

3 楼

终于有人回复咯,这是小弟,第一次写的程序,不知道你看我到我发的(1)没有,那里我说了的,写的时间没写注释,遗憾啊!我主要是提供一个程序,让大家冲整体上来把握然后写一个程序的。如果大家敢兴趣对某一部分,我会解释的

我来回复

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