91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 9.2 KB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2024-12-03
  • 語言: 其他
  • 標簽:

資源簡介

教學計劃編制系統(tǒng)-數(shù)據(jù)結構課設源代碼。VC6.0

資源截圖

代碼片段和文件信息

#include?
#include?
#define?MAX_VERTEX_NUM?100?//最大課程總數(shù)
#define?NOTSTUDY?0
#define?STUDY?1
#define?STACK_INIT_SIZE?100?//存儲空間的初時分配量
#define?STACKINCREMENT?10????//存儲空間的分配增量

typedef?struct?ArcNode{
int?adjvex;
struct?ArcNode?*nextarc;
}ArcNode;

typedef?struct?VNode{
char?name[24];???????//課程名
int?classid;??????//課程號
int?credit;?????????//課程的學分
int?indegree;???????//該結點的入度
int?state;??????????//該節(jié)點的狀態(tài)
ArcNode?*firstarc;?//指向第一條依附該頂點的弧的指針
}VNodeAdjList[MAX_VERTEX_NUM];

typedef?struct{
AdjList?vertices;
int?vexnum?arcnum;
}ALGraph;

typedef?struct
{
????int*?base;
????int*?top;
????int?stacksize;
}SqStack;

void?InitStack70310(SqStack*?S)
{
????S->base=(int?*)malloc(STACK_INIT_SIZE*sizeof(int));
????if?(!S->base)
????{
????????printf(“ERROR“);
????????exit(1);
????}
????S->top=S->base;
????S->stacksize=STACK_INIT_SIZE;
}
int?StackEmpty70310(SqStack*?S)
{
????if(S->top==S->base)
????????return?1;
????else
????????return?0;
}
void?Push70310(SqStack?*Sint?e)
{
????if(S->top?-?S->base?>=?S->stacksize)
????{
????????S->base?=?(int*)realloc?(S->base(S->stacksize?+?STACKINCREMENT)?*?sizeof(int));
????????if(!S->base)
????????{
????????????printf(“ERROR“);
????????????exit(1);
????????}
????????S->top?=?S->base?+?S->stacksize;
????????S->stacksize?+=?STACKINCREMENT;
????}
????*S->top++?=?e;
}
int?Pop70310(SqStack?*S?int?*e)
{
????if(S->top?==?S->base)?exit(1);
????*e?=?*?--(S->top);
????return?0;
}
void?FindInDegree70310(ALGraph?G?int?indegree[])//求圖中各節(jié)點的入度
{
????int?i;
????for?(i?=?1;?i?<=?G.vexnum;?i++)
????????indegree[i]?=?0;
????for?(i?=?1;?i?<=?G.vexnum;?i++)
????{
????????while?(G.vertices[i].firstarc)
????????{
????????????indegree[G.vertices[i].firstarc->adjvex]++;
????????????G.vertices[i].firstarc?=?G.vertices[i].firstarc->nextarc;
????????}
????}
}




void?TopologicalSort_1_70310(ALGraph?Gint?numtermint?uplcredit)
{
????FILE?*fp;
????fp=fopen(“bianpai.txt““w“);
????ArcNode?*p;
????SqStack?S;
????int?indegree[MAX_VERTEX_NUM];//存放各節(jié)點的入度
????int?ij?k;
????int?count;?//課程編排數(shù)目計數(shù)器
????int?sumcredit;//每個學期的課程學分累加器
????FindInDegree70310(G?indegree);
????for?(i?=?1;?i?<=?G.vexnum;?i++)
??????G.vertices[i].indegree=indegree[i];
????InitStack70310(&S);
????count=0;
????k=0;
?????while(count!=G.vexnum?&&?k<=numterm)
????{
????????sumcredit=0;
????????for(i=1;i<=G.vexnum;i++)?//入度為零的節(jié)點入棧,即無先修的課程入棧
????????????if((G.vertices[i].indegree==0)&&(G.vertices[i].state==NOTSTUDY))
???????????{
????????????????????Push70310(&Si);
??????????????G.vertices[i].state?=?STUDY;//避免入度為零節(jié)點重復入棧
????????????}
????????if(!StackEmpty70310(&S)&&(sumcredit<=uplcredit))
????????{
????????????k=?k+1;
????????????printf(“\n“);
????????????printf(“第%d個學期學得課程有:\n“k);
????????????sumcredit?=?0;
????????????for(i=1;i<=G.vexnum;i++)//入度為零的節(jié)點入棧,即無先修的課程入棧
????????????????if((G.vertices[i].indegree==0)&&(G.vertices[i].state==NOTSTUDY))

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????8799??2013-06-19?10:03??數(shù)據(jù)結構課設源代碼\12.cpp

?????文件???????4236??2013-06-19?10:03??數(shù)據(jù)結構課設源代碼\12.dsp

?????文件????????529??2013-06-19?10:03??數(shù)據(jù)結構課設源代碼\12.dsw

?????文件??????33792??2013-06-19?10:03??數(shù)據(jù)結構課設源代碼\12.ncb

?????文件??????48640??2013-06-19?10:03??數(shù)據(jù)結構課設源代碼\12.opt

?????文件????????868??2013-06-19?10:03??數(shù)據(jù)結構課設源代碼\12.plg

?????目錄??????????0??2013-09-01?20:53??數(shù)據(jù)結構課設源代碼

-----------?---------??----------?-----??----

????????????????96864????????????????????7


評論

共有 條評論

相關資源