三九宝宝网宝宝教育教学论文

c排课系统的算法

03月12日 编辑 39baobao.com

[C语言矩形填充算法]#include <stdio.h> #include <graphics.h> typedef struct { int xmin, xmax, ymin, ymax; } Rectangle; void FillRectangle(Rectangle *rect, int color) { int x = 0, y...+阅读

这个不是排列组合题目吧?如果不是,那就很简单。大致说下思路,自己实现吧。

把学校机房的课时按每小时或者按几个小时为单位编成一个数据结构。这个具体看学校怎么安排上机课,如果最小单位为2小时,当然以2小时为单位,如果有班级只上半小时的上机课当然以半小时为单位。比如一周5天每天10小时我们可以把它编成50个单位的一个数据结构。可以为数组,可以为链表,当然也可以为更复杂的结构,看你的需要。简单的机房上机课时结构基本子元素为:起止时间、已安排班级(若未安排则为空)、已安排老师

把班级和老师也储存在一个数据结构里。然后确定班级排上机课的原则。比如是平均分配机时,那么将每个班级增加一个计数器。那么班级的数据结构每个元素至少要有这么几个子元素:班级标识、班级计数器、班级空闲时间表。排上机课的时候,首先取出机房上机课时的数据结构,取出第一个元素,然后遍历存储班级信息的数据结构,优先取出班级计数器最小的班级,查看这个班级这时是否有课,无课则插入到上机课时的数据结构中,同时将班级计数器加一,有课则选择下一个计数器数字最小的元素。(计数器只是表示班级安排了多少上机课,也可以用一个数字代替,仅仅表示权重,比如计算机系的班级权重就可以调高。建议将整个链表中计数器数字的最小值保存在这个链表的某处,使得访问者一开始就能得到而不用访问所有元素)。重复上述过程,直到所有上机课时都被分配。

老师的分配过程和上述班级分配类似。

看来是新手,加油!

C语言学生选修课系统

",&num,&na,&teacher,teacher[20]; char na[10]; char teacher[20]; char wtime[10]; char ttime[10]; int score;score); fclose(fp); } void prin(SUB *head) { SUB *p; if (head==NULL) { printf("ptr2=ptr2->for(p=head; head->wtime; struct subjects *next; }SUB!=0) { p=(SUB*)malloc(sizeof(SUB)); p->, ch1; printf("是否进行插入课程; SUB *create_form() { SUB *head,*tail,*p;);n"); return;w"); fprintf(fp,"欢迎进入东华理工大学2008-2009学年选修课系统(4-13)\ char na[10]; } else{ for(ptr2=head;ptr2:\n" int num;next) fprintf(fp,"%6d%10s%14s%10s%8s%6d",&wtime,&ttime:按学号,p->next=NULL;欢迎进入东华理工大学2008-2009学年选修课系统(4-13)\n"/7《学生选修课程系统》设计任务//);na,p->teacher,p->wtime,p->ttime,p->score);score); if(head==NULL){ head=ptr,&score),ttime[10]; head=tail=NULL; printf(" printf(",subj->ttime,subj->p; p->score=score; if(head==NULL) head=p;teacher; while(num; 输入选课程信息,以6个0结束.h>#includeteacher,teacher)。

// else tail->next=p;n"); scanf("%d%10s%14s%10s%8s%6d"; scanf("%d%s%s%s%s%d"; } SUB *inset(SUB *head) { SUB *ptr,*ptr2,*subj; char ch;)、班级、姓名; return head,如果需要插入请按回车建;wtime;课程代码 课名 任教老师 上课星期 上课时间 学分\,&score); } return head; } SUB *del(SUB *head) { SUB*p1,*p2; char ch,ch1; int num; printf("是否进行课程删除,要删除请按回车键,不进行请按空格:\n"); ch=getchar(); while(ch!=' ') { printf("输入要删除的课程代码:\n"); scanf("%d",&num); if(head->num==num){ p2=head; head=head->next; free(p2); } if(head==NULL) return NULL; p1=head; p2=head->next; while(p2!=NULL){ if(p2->num==num){ p1->next=p2->next; free(p2); } else p1=p2; p2=p1->next; } printf("继续删除请按回车键,结束请按空格:\n"); ch1=getchar(); ch=getchar(); } return head; } typedef struct student { int number; int classes; char chinesename[16]; char title [5][12]; struct student *other; }STU; void scanf_form(SUB *head) { int i,count,number,classes; char ch,title[3][12],chinesename[16]; scanf("%d%d%16s",&number,&classes,&chinesename); for(i=0;inumber=number; q->classes=classes; strcpy(p->chinesename,chinesename); for(i=0;ititle[i],title[i][12]); if(hand=NULL) hand=q; else tall->other=q; tall=q; scanf_form(); for(i=0;ina)!=0&titli[i][12]!='0') { printf("你输入的课程名不正确,请从新输入:\n"); scanf_form(); } } tall->other=NULL; return hand; } } void savefiles(STU*hand) { STU *q; FILE *fq; fq=fopen("studennt.txt","w"); fprintf(fq, "学生选课信息表:\n"); for(q=hand;q;q=q->other) fprintf(fq,"%16d%10d%16s%16s%16s%16s%16s%16s",q->number,q->classes,q->chinesename,q->title[0],q->title[1],q->title[2],q->title[3],q->title[4]); fclose(fq); } void prins(STU*hand) { STU *q; if(head==NULL) { printf("没有学生选课信息记录!\n"); return; } printf("学生选课信息一览表:\n"); printf("学号 班级 姓名 课名 :\n"); for(q=hand;q;q->number) printf("%16d%10d%16s%16s%16s%16s%16s%16s",q->number,q->classes,q->chinesename,q->title[0],q->title[1],q->title[2],q->title[3],q->title[4]); } STU *intserts(SUB*head,STU *hand) { STU *prt,*prt2,*stuj; int i; char ch,ch1; printf("是否要进行插入学生选课信息,如果需要请按回车建,结束请按0:\n"); ch=getchar(); while(ch!=' ') { stuj=(STU*)malloc(sizeof(STU)); prt=stuj; printf("输入要插入的学生选课信息:\n"); scanf_form(); if(hand==NULL) {hand=prt; hand->other=NULL; } else {for(prt2=hand;prt2;prt2=prt2->other) if(prt2->other==NULL) {prt2->other=stuj; stuj->other=NULL; break; }; } printf("继续插入请按回车建,结束请按空格:\n"); ch1=getchar(); ch=getchar(); } return hand; } STU *dells(STU *hand) { STU *q1,*q2; char ch,ch1; int number; printf("是否进行学生选课信息删除,要删除请按回车建,不进行请按空格:\n"); ch=getchar(); while(ch!=' ') { printf("输入要删除的学号:\n"); scanf("%d",&number); if(hand->number==number) { q2=...

设计排课程序有酬谢

#include#include#include#include#define N 10#define M 20#define SIZE 40using namespace std;typedef struct tcnode{ char name[20]; int ipri;}tclist,*ptclist;typedef struct node{ char name[20]; char num[20]; int work_time; tclist tc[M]; char cbuf[SIZE]; struct node *next; }tlist,*ptlist;typedef struct Node{ char name[20]; char num[20]; int week_time; int all_time; int priority; bool mc; //是否被选 struct Node *next;}clist,*pclist;class teacher{public: teacher(); ~teacher(); void initdata(); void save(); friend void print(teacher&,ptlist); tlist* pt;};class course{public: course(); ~course(); void initdata(); void save(); friend pclist convert(course&,char * s);private: clist* pc;}; teacher::teacher(){ pt=NULL;} teacher::~teacher(){ ptlist p; while(pt) { p=pt; pt=pt->next; delete p; }}void teacher::initdata(){ char tag; ptlist p=pt; ptlist s; int t=0; coutmc) { sum+=(convert(c,q->tc[i].name))->all_time; (convert(c,q->tc[i].name))->mc=false; if(i==0) strcpy(q->cbuf,q->tc[i].name); else { strcat(q->cbuf," "); strcat(q->cbuf,q->tc[i].name); } if(sum>=q->work_time) break; } } sum=0; q=q->next; } }cout

求个vb6 0 sql2000的高校排课系统的代码核心的排课代码也可以最好

Private Sub Command1_Click()

If Command1.Caption = "隐藏" Then

Text1.Visible = False

Command1.Caption = "显示"

ElseIf Command1.Caption = "显示" Then

Text1.Visible = True

Command1.Caption = "隐藏"

End If

End Sub

Private Sub Command2_Click()

End

End Sub

Private Sub Form_Load()

Text1.Visible = True

Command1.Caption = "隐藏"

End Sub

以下为关联文档:

c语言选排列算法该函数求得是自由组合数,输出是An取k的所有可能组合 #include <stdio.h> int n,k,a[10]; long count=0; void perm2(int j) { int i,p,t; if(j==k) //执行条件j=k { for(i=k;...

操作系统模拟电梯调度算法C语言程序多级反馈队列调度算法是一种CPU处理机调度算法,UNIX操作系统采取的便是这种调度算法。 多级反馈队列调度算法即能使高优先级的作业得到响应又能使短作业(进程)迅速完成。(对比一...

c语言大数除法算法#include#include#define MAXSIZE 1025 void Div(char *str1, char *str2, char *str3) { int i1, i2, i, j, jj, tag, carry, cf, c[MAXSIZE]; int len1 = strlen(str1), l...

C语言组合算法排列组合的公式数学里有 组合的公式是nCm=n!/(m!(n-m)!) 但是排列组合的计算式子快捷方法不是这么做的 n*(n-1)……*(n-m+1)/m*(m-1)……*1 设两个循环 #include<stdio.h> voi...

c语言大数算法#include#include#define MAXSIZE 600 void Add(char *str1, char *str2, char *str3){// str3 = str1 + str2; int i, j, i1, i2, tmp, carry; int len1 = strlen(str1), l...

C语言快速排序算法1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 0和N-1表示的是数组下标。快排每一趟排序的目的是使值比设定的key值...

C语言查找算法实现#include int main() { int i,x,n,*result = NULL; int a[10],low,high,mid; scanf_s("%d",&n); // 确保输入的数据是非递减的 for(i = 0 ; i scanf_s("%d",&a[i]); } fflush(st...

C语言数据分组的算法如果你是希望通过输入来确定b的个数,又不想多申请空间,那就是动态数组的声明了,能够实现。 首先输入n,表示要输入的b[]的元素个数,在通过这个语句: int *b= (int*)malloc(n*sizeof...

C语言插入排序算法int main () { int i; DataType a[MaxSize]; SqList L; srand((unsigned)time(NULL)); for (i=0;i{ int number = rand()%MaxSize + 1; //printf ("%d ",number); a[i].key =...

推荐阅读
图文推荐