資源簡介
這是一個從文件讀入一個關系R的矩陣表示,然后計算他的偏序關系矩陣
和最小偏序關系矩陣,最后由最小偏序矩陣畫出哈斯圖的程序。
代碼片段和文件信息
#undef?UNICODE
#undef?_UNICODE
#include
#include
#include
#include
#include
#include
#define?TRUE?1
#define?FALSE?0
struct?Point{
int?layerNum;//層號
int?number;//頂點的編號
int?x;//頂點的x坐標
int?y;//頂點的y坐標
};
void?Partial(FILE?*?int);
void?convert(int?**?int);
void?draw(struct?Point?*?int??int?**?int);
int?main(){
FILE?*inFile;
char?fileName[81];
int?m;
char?c;
while(1){
printf(“請輸入測試文件地址:“);
gets(fileName);
inFile?=?fopen(fileName?“r“);
if(inFile?==?NULL){
printf(“文件不存在!“);
getchar();
exit(1);
}
fscanf(inFile?“%d“?&m);
//計算文件中關系矩陣的等價閉包
Partial(inFile?m);
fclose(inFile);
printf(“請按任意鍵繼續\n“);
getch();
//清屏
system(“CLS“);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????814653??2015-10-28?02:45??哈斯圖\EasyX_20151015(beta).zip
?????文件???????5533??2015-10-28?23:30??哈斯圖\Hasse.cpp
?????文件?????????62??2009-11-17?20:39??哈斯圖\test1.txt
?????文件??????68778??2015-10-29?00:00??哈斯圖\使用說明.docx
?????目錄??????????0??2015-10-29?00:01??哈斯圖
-----------?---------??----------?-----??----
???????????????889026????????????????????5
- 上一篇:距離矢量路由算法
- 下一篇:帶拼寫錯誤檢查的字典小程序C語言代碼
評論
共有 條評論