| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 404 人关注过本帖
标题:救急:这个题目是网上搜到的,不知道对不对应,而且有一个地方出错了
只看楼主 加入收藏
cyd95
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2014-1-31
收藏
 问题点数:0 回复次数:0 
救急:这个题目是网上搜到的,不知道对不对应,而且有一个地方出错了
一、实验题目
职工人事管理系统设计功能:实现简单的职工人事信息管理,基本信息包括职工编号、姓名、性别、年龄、身份证号和简历
基本要求:
1. 设计简单的菜单,能够进行系统功能选择。
2. 实现信息的录入功能。
3. 在已有信息的基础上添加新的记录。
4. 删除指定编号的记录。
5. 修改指定编号的记录
6. 实现信息的浏览功能
7. 按编号查询功能
8. 按身份证号排序功能




二、程序代码
#define MAX_BAR 4  /*最大菜单数,可以自定*/
#include"io.h"  
#include"dos.h"  
#include"fcntl.h"
#include"stdio.h"  
#include"stdlib.h"  
#include"math.h"  
#include"graphics.h"  
#include"chi_asc.c"  /*调用图形模式下汉字、字符共显功能*/ #include"public.c"  /*按键定义功能*/
#include"mypcx.c"  /*封面图象调用功能,此处为pcx图象*/ #include"stu_frame.c"  /*框架绘制功能*/
#include"stu_sub.c"  /*各子菜单功能*/
 main() {   
/*old_bar、curr_bar表示上次选中的菜单、当前选中的菜单*/
/*old_sonbar curr_sonbar表示上次选中的子菜单、当前选中的子菜单*/
int i,key,key_son,old_bar,curr_bar,curr_sonbar,old_sonbar,size;   
int save_startx,save_starty,save_endx,save_endy,sonbar_out=0;   
void *buf;   
int Driver,Mode;   
char *pcx;
struct student_bar{   
int start_x,start_y;   /*起始横坐标,起始纵坐标*/     
int length_x,length_y;  /*菜单的长,菜单的宽*/     
int num_son;  /*包含子菜单的个数*/     
char *p_father;  /*菜单项名,*p_son[5]为子菜单名*/     
char *p_son[5];}
stu_bar[MAX_BAR]={        
   {10,45,120,25,4,"File Operation",{" Open file"," New  file"," Save         file","Exit system"}},      
   {130,45,120,25,3,"Data Edition",{" Add object","Delete         object","Modify object"}},      
   {250,45,120,25,0,"File Print",{""}},      
   {370,45,120,25,0,"Help Message",{""}}      
 };/*定义各功能菜单的结构体*/

pcx="stusys4.pcx";   
Set_Video_Mode(VGA256);  /*转换屏幕到320*200*256色*/   
PCX_Load_Screen(pcx,1);  /*读取封面图象stusys4.pcx*/

Driver=DETECT,Mode=0;   

initgraph(&Driver,&Mode,"");  /*设置图象模式*/   
cleardevice();   
main_frame(BLUE,LIGHTGRAY);  /*绘制主框架图,底色为蓝色*/   /*绘制菜单*/

for(i=0;i<MAX_BAR;i++)     
{
   setcolor(BLUE);   
   rectangle(stu_bar[i].start_x, stu_bar[i].start_y, stu_bar[i].start_x      +stu_bar[i].length_x, stu_bar[i].start_y+stu_bar[i].length_y);        puthz16(stu_bar[i].start_x+8,stu_bar[i].start_y+5,-8,BLUE,stu_bar      [i].p_father);     }
   puthz16(stu_bar[0].start_x+8,stu_bar[0].start_y+5,-8,WHITE,stu_bar      [0].p_father);      
   old_bar=0;curr_bar=0;
/*读取按键字符,如为ESC则退出*/  
 while((key=specialkey())!=ESC){      
old_bar=curr_bar;      
 if(sonbar_out==1)sonbar_out=0;
 if(key==LEFT){if(curr_bar==0)curr_bar=3;else curr_bar=curr_bar-1; }
/*LEFT finished*/
if(key==RIGHT){        
  if(curr_bar==3)curr_bar=0;        
   else curr_bar=curr_bar+1;   
}/*RIGHT finished*/ /*如按键为ENTER,则绘制子菜单*/

if(key==ENTER){        
save_startx=stu_bar[curr_bar].start_x;        
save_starty=stu_bar[curr_bar].start_y+stu_bar[curr_bar].length_y+1;      save_endx=stu_bar[curr_bar].start_x+stu_bar[curr_bar].length_x;
/*保存子菜单展开后掩盖住的图象*/        
save_endy=stu_bar[curr_bar].start_y+stu_bar[curr_bar].length_y+stu_bar  [curr_bar].num_son*stu_bar[curr_bar].length_y+1;     
size=imagesize(save_startx,save_starty,save_endx,save_endy);

  if(size!=-1)
{  buf=malloc(size);   
   if(buf)getimage(save_startx,save_starty,save_endx,save_endy,buf);        else {printf("OUT MEMORY");exit(0);}
}

setviewport(save_startx,save_starty,save_endx,save_endy,1);   setcolor(WHITE);   
clearviewport();   
for(i=1;i<=stu_bar[curr_bar].num_son;i++)   
{     rectangle(0,0,stu_bar[curr_bar].length_x,i*stu_bar  [curr_bar].length_y);     
setfillstyle(SOLID_FILL,LIGHTGRAY);     
floodfill(stu_bar[curr_bar].length_x-1,i*stu_bar[curr_bar].length_y-1,WHITE);        }
  
  for(i=0;i<stu_bar[curr_bar].num_son;i++)     
puthz16(8,i*stu_bar[curr_bar].length_y+5,-8,BLUE,stu_bar[curr_bar].p_son[i]);

puthz16(8,5,-8,WHITE,stu_bar[curr_bar].p_son[0]);      old_sonbar=0;curr_sonbar=0;

 if(stu_bar[curr_bar].num_son)
while(((key_son=specialkey())!=ESC)&&sonbar_out==0)
{  old_sonbar=curr_sonbar;   
if(key_son==UP)
{     if(curr_sonbar==0) curr_sonbar=stu_bar[curr_bar].num_son-1;   
 else curr_sonbar=curr_sonbar-1;   
}

if(key_son==DOWN){     
if(curr_sonbar==(stu_bar[curr_bar].num_son-1)) curr_sonbar=0;   
 else curr_sonbar=curr_sonbar+1;   
}

 puthz16(8,old_sonbar*stu_bar[curr_bar].length_y+5,-8,BLUE,stu_bar  [curr_bar].p_son[old_sonbar]);
 puthz16(8,curr_sonbar*stu_bar[curr_bar].length_y+5,-8,WHITE,stu_bar  [curr_bar].p_son[curr_sonbar]);


 if(key_son==ENTER){         
setviewport(0,0,639,479,1);  
putimage(save_startx,save_starty,buf,COPY_PUT);  
free(buf);      
sonbar_out=1;     
if(curr_bar==0)      
switch(curr_sonbar){
case 0:   
fil_open();   /*调用stu_sub.c文件中fil_open()函数,打开文件*/    break;      case 1:   
fil_new();  /*调用stu_sub.c文件中fil_new()函数,新建文件*/    break;        case 2:   
fil_save();  /*调用stu_sub.c文件中fil_save()函数,保存文件*/    break;       case 3:   
sys_exit();   /*调用stu_sub.c文件中sys_exit()函数,退出系统*/   
}
  if(curr_bar==1)      
switch(curr_sonbar)
{
case 0:   
 dat_add();  /*调用stu_sub.c文件中dat_add()函数,添加记录*/     break;
case 1:   
 dat_dele();   /*调用stu_sub.c文件中dat_dele()函数,删除记录*/     break; case 2:     dat_mod();  /*调用stu_sub.c文件中dat_mod()函数,修改记录*/     break;   
}  

 } /*key_son=ENTER finished*/     
}/*key_son all finished*/

if(sonbar_out==0){  
setviewport(0,0,639,479,1);
 putimage(save_startx,save_starty,buf,COPY_PUT);  
free(buf);  /*还原子菜单掩盖住的图象,并释放子菜单所占用的内存*/
 }

/*如果子菜单项为0*/     
if(!stu_bar[curr_bar].num_son)
{ if(curr_bar==2)   fil_prn();
/*调用stu_sub.c文件中fil_prn()函数,打印文件*/
if(curr_bar==3)   hel_mess();  
/*调用stu_sub.c文件中hel_mess()函数,显示帮助信息*/     
 }
} /*ENTER finished*/

puthz16(stu_bar[old_bar].start_x+8,stu_bar[old_bar].start_y+5,-  8,BLUE,stu_bar[old_bar].p_father);      
puthz16(stu_bar[curr_bar].start_x+8,stu_bar[curr_bar].start_y+5,-  8,WHITE,stu_bar[curr_bar].p_father);

  }/*key all finished*/  
 fcloseall();  /*关闭所有文件*/   
closegraph();  /*关闭图形状态*/   }
搜索更多相关主题的帖子: include 管理系统 身份证号 而且 网上 
2014-01-31 22:26
快速回复:救急:这个题目是网上搜到的,不知道对不对应,而且有一个地方出错了
数据加载中...
 
   



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

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