博文

C语言课程设计_工资管理(2006-06-19 12:57:00)

摘要:/******头文件(.h)***********/#include "stdio.h"    /*I/O函数*/# include "bios.h"  /*ROM基本输入输出函数*/#include "dos.h"    /*dos接口函数*/#include "conio.h"   /*屏幕操作函数*/#include "stdlib.h"   /*其它说明*/#include "string.h"  /*字符串函数*/#include "mem.h"  /*内存操作函数*/#include "ctype.h" /*字符操作函数*/#include "alloc.h"  /*动态地址分配函数*//****变量定义*******/typedef struct z1    /*定义数据结构*/{   char no[11];     /*编号*/   char name[15];  /*姓名*/   float jbgz;     /*基本工资*/   float koukuan; /*扣款*/   float yfgz;  /*应发工资*/   float shuijin;  /*税金*/   float sfgz;   /*实发工资*/   struct z1 *prior;/*前驱指针*/   struct z1 *next;/*后继指针*/}SALARY;     /*结构体类型名*/struct z1 *First;   /*双链表头指针*/struct z1 *Last;   /*双链表尾指针*//******函数原型*********/void init();&n......

阅读全文(18954) | 评论:14

C语言课程设计]图书借阅管理(2006-06-19 12:56:00)

摘要:/* book.c源程序*/#include <dos.h>#include <bios.h>#include <conio.h>#include <stdio.h>#include <stdlib.h>#include <math.h>#define LEFT 0x4b00  /*左*/#define RIGHT 0x4d00 /*右*/#define DOWN 0x5000 /*下*/#define UP 0x4800 /*上*/#define SPACE 0x3920 /*空格*/#define ESC 0x011b /* ESC键*/#define ENTER 0x1c0d /*回车键*/#define Backspace 0xe08 /*擦除键*/#define ALT_B 12288 /*组合键ALT_B */#define ALT_M 12800/*组合键ALT_M */#define ALT_H 8960/*组合键ALT_H */int key;/*按键变量*/int textx,texty;/*光标坐标,x行,y列*/struct menustruct/*菜单用的结构体*/{   char name[10];/*主菜单名*/   char str[10][20];/*选项*/   int n;/*选项数*/}ml[3];/*使用了3个,可根据需要增删*/typedef struct BookList/*书的结构体*/{   char num[20];/*图书编号*/   char name[20];/*书名*/   int price;/*书的价格*/   char person[20];/*借阅人*/   int yes;/*判断书是否存在或者已经借出,1存在,0借出*/   struct BookList *next;}Book;typedef struct MemberList/*会员的结构体*/{   char name[20];/*会员的姓名*/&nb......

阅读全文(16596) | 评论:7

C语言课程设计_进程调度(2006-06-19 12:55:00)

摘要:#include "stdio.h"#include "stdlib.h"#include "string.h"typedef struct node{   char name[10];  /*进程标识符*/   int prio;   /*进程优先数*/   int round;  /*进程时间轮转时间片*/   int cputime; /*进程占用CPU时间*/   int needtime; /*进程到完成还要的时间*/   int count;  /*计数器*/   char state; /*进程的状态*/   struct node *next; /*链指针*/}PCB;PCB *finish,*ready,*tail,*run; /*队列指针*/int N; /*进程数*//*将就绪队列中的第一个进程投入运行*/firstin(){   run=ready;   /*就绪队列头指针赋值给运行头指针*/   run->state='R';   /*进程状态变为运行态*/   ready=ready->next;  /*就绪对列头指针后移到下一进程*/}/*标题输出函数*/void prt1(char a){   if(toupper(a)=='P') /*优先数法*/      printf("  name     cputime  needtime  priority  state\n");   else      printf("  name     cputime  ......

阅读全文(14421) | 评论:2

存储管理分区分配算法 代码(2006-06-19 12:55:00)

摘要:/***pcb.c***/#include "stdio.h"#include "stdlib.h"#include "string.h"#define MAX 32767typedef struct node   /*设置分区描述器*/{   int address,size;   struct node *next;}RECT;/*函数原型*/RECT *assignment(RECT *head,int application);void acceptment1(RECT *head,RECT *back1);void acceptment2(RECT *head,RECT *back1) ;int backcheck(RECT *head,RECT *back1);void print(RECT *head);/*变量声明*/RECT *head,*back,*assign1,*p;int application1,maxblocknum;char way;/*主函数*/main(){   char choose[10];   int check;   head=malloc(sizeof(RECT)); /*建立可利用区表的初始状态*/   p=malloc(sizeof(RECT));   head->size=MAX;   head->address=0;   head->next=p;   maxblocknum=1;   p->size=MAX;   p->address=0;   p->next=NULL;   print(head);  /*输出可利用表初始状态*/   printf("Enter the way(best or first(b/f)\n");/*选择适应策略*/   scanf("%c",&way);   do......

阅读全文(17921) | 评论:4

学生成绩管理系统(2006-06-19 12:54:00)

摘要:#include "stdio.h"    /*I/O函数*/#include "stdlib.h"   /*其它说明*/#include "string.h"   /*字符串函数*/#include "conio.h"   /*屏幕操作函数*/#include "mem.h"   /*内存操作函数*/#include "ctype.h"   /*字符操作函数*/#include "alloc.h"   /*动态地址分配函数*/struct score{int mingci;char xuehao[8];char mingzi[20];float score[6];}data,info[1000];int i,j,k=0;char temp[20],ch;FILE *fp,*fp1;void shuru(){if((fp=fopen("s_score.txt","ab+"))==NULL){  printf("cannot open this file.\n");  getch();exit(0);}for(i=0;i<=1000;i++){    printf("\nPlease shuru xuehao:");    gets(data.xuehao);    printf("Please shuru mingzi:");    gets(data.mingzi);    printf("Please shuru yuwen score:");    gets(temp);data.score[0]=atof(temp);    printf("Please shuru shuxue score:");    gets(temp);data.score[1]=atof(temp);    printf("Please input yingyu score:");    gets(te......

阅读全文(16464) | 评论:3

c语言课程设计_通讯录(2006-06-19 12:53:00)

摘要:/*编程建立一通讯簿,存放有姓名、电话号码、住址,然后对通信簿进行查找、添加、修改及删除。*/#include<stdio.h>struct person{ char name[8];    char tel[15];    char addr[50];}; char filename[20];FILE *fp; void creat();void output();void search();void append();void modify();void delete(); main(){ int m;   creat();    while(1) {  printf("\n\n添加,请按1");   printf("\n查找,请按2");  printf("\n修改,请按3");  printf("\n删除,请按4");  printf("\n输出,请按5");  printf("\n退出,请按0\n");  scanf("%d",&m);  if(m>=0&&m<=5)  {   switch(m)      {   case 1: append();        break;   case 2: search();     break;   case 3: modify();     break;   case 4: delete();     break;&nbs......

阅读全文(21031) | 评论:28

c语言课程设计_鼠标器(2006-06-19 12:53:00)

摘要:#include<dos.h>#include<conio.h>#include<string.h>#include<math.h>#include<stdlib.h>#include<stdio.h>#define HEX 0#define DEC 1#define OCT 2#define BIN 3 int index=0,choice=0;/*初始化鼠标器*/void initmouse(){ _AX=0; geninterrupt(0x33); }/*显示鼠标光标*/void showmouse(){ _AX=1; geninterrupt(0x33);}/*隐藏鼠标*/void hidemouse(){ _AX=2; geninterrupt(0x33);}/*取鼠标状态和鼠标位置*/void getmouse(int *button,int *x,int *y){ _AX=3; _BX=0; geninterrupt(0x33); *button=_BL; *x=_CX; *y=_DX;}/*设置程序中的数字字符表*/int getnum(char c){ int j; char alpha_set[36]="0123456789abcdefghijklmnopqrstuvwzyz"; for(j=0;j<36;j++) {  if(alpha_set[j]==c)   break; } return j;}/*把任意radix进制的数,转换为十进制数*/unsigned long convert_to_decimal(char *_num,int radix){ int i,len; unsigned long dec=0; len=strlen(_num); len--; for(i=0;_num[i]!=NULL;i++,len--) {  dec+=......

阅读全文(13777) | 评论:0

c语言课程设计_菜单设计(2006-06-19 12:52:00)

摘要:#include <conio.h>#include<dos.h>#include <graphics.h>#include<stdio.h>#include<stdlib.h> /*定义一些常数*/#define NO 0#define YES 1#define NONE -1#define MAX_MENU 7/*根据情况改变可以在菜单显示的最大项*/ /*全局参数*/int X,Y;int Selection;int button,x,y;void *p;size_t area; /*菜单结构*/struct MENU{      /*左上角*/      int x;       int y;      /*右下角*/      int x1;      int y1;      unsigned char Active[MAX_MENU];/* 菜单项是否激活的标志*/      char *head;/* 菜单的名字(可选项)*/}; int MouseOn(struct MENU *t);void Process();void Xorbar(int sx,int sy,int ex,int ey,int c);void Show();void Hide();void Status(); /* 通过下面的参数用户可以改变按钮的位置。*/ struct MENU File={200,110,250,130};struct MENU Edit={295,110,345,130};struct MENU Help={390,110,440,130};struct MENU Close={600,10,620,30};struct MENU Neeraj={380,300,460,315}......

阅读全文(19190) | 评论:9

C语言课程设计_贪吃蛇代码(2006-06-19 12:51:00)

摘要:#define N 200#include <graphics.h>#include <stdlib.h>#include <dos.h>#define LEFT 0x4b00#define RIGHT 0x4d00#define DOWN 0x5000#define UP 0x4800#define ESC 0x011bint i,key;int score=0;/*得分*/int gamespeed=50000;/*游戏速度自己调整*/struct Food{   int x;/*食物的横坐标*/   int y;/*食物的纵坐标*/   int yes;/*判断是否要出现食物的变量*/}food;/*食物的结构体*/struct Snake{   int x[N];   int y[N];   int node;/*蛇的节数*/   int direction;/*蛇移动方向*/   int life;/* 蛇的生命,0活着,1死亡*/}snake;void Init(void);/*图形驱动*/void Close(void);/*图形结束*/void DrawK(void);/*开始画面*/void GameOver(void);/*结束游戏*/void GamePlay(void);/*玩游戏具体过程*/void PrScore(void);/*输出成绩*//*主函数*/void main(void){   Init();/*图形驱动*/   DrawK();/*开始画面*/   GamePlay();/*玩游戏具体过程*/   Close();/*图形结束*/}/*图形驱动*/void Init(void){   int gd=DETECT,gm;   initgraph(&gd,&gm,"c:\\tc");   cleardevice();}/*开始画面,左上角坐标为(50,40),右下角坐标为(610,......

阅读全文(53380) | 评论:22

c语言课程设计_计算器设计(2006-06-19 12:50:00)

摘要:#include <dos.h>   /*DOS接口函数*/ #include <math.h>   /*数学函数的定义*/ #include <conio.h>  /*屏幕操作函数*/ #include <stdio.h>  /*I/O函数*/ #include <stdlib.h>  /*库函数*/ #include <stdarg.h>  /*变量长度参数表*/ #include <graphics.h>  /*图形函数*/ #include <string.h>  /*字符串函数*/ #include <ctype.h>  /*字符操作函数*/ #define UP 0x48    /*光标上移键*/ #define DOWN 0x50  /*光标下移键*/ #define LEFT 0x4b  /*光标左移键*/ #define RIGHT 0x4d  /*光标右移键*/ #define ENTER 0x0d  /*回车键*/ void *rar;       /*全局变量,保存光标图象*/ struct palettetype palette; /*使用调色板信息*/ int  GraphDriver; /* 图形设备驱动*/ int  GraphMode; /* 图形模式值*/ int  ErrorCode;  /* 错误代码*/ int  MaxColors;  /* 可用颜色的最大数值*/ int  MaxX, MaxY; /* 屏幕的最大分辨率*/ double  AspectRatio; /* 屏幕的像素比*/ void drawboder(void); /*画边框函数*/ void initialize(void);  /*初始化函数*/ void computer......

阅读全文(21056) | 评论:8