-
大小: 11.93MB文件類型: .zip金幣: 1下載: 0 次發(fā)布日期: 2023-07-06
- 語言: C/C++
- 標(biāo)簽: C++??arrayWGraph??
資源簡介
《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目,開發(fā)C++類arrayWGraph,用臨接數(shù)組描述加權(quán)無向圖,帶界面,有報告,開發(fā)工具為Visual Studio 2015。本項目開發(fā)arrayWGraph類首先對課本上的Graph類進(jìn)行繼承,對其主要的純虛函數(shù)進(jìn)行逐個的實現(xiàn),例如構(gòu)建無向圖,增加邊,刪除邊等操作。完全按照面向?qū)ο蟮乃枷雽瘮?shù)和程序進(jìn)行編寫,除此之外,又增加了一些對于arrayWGraph類使用的操作函數(shù)。讓使用者使用起來更加的方便。
代碼片段和文件信息
#include?
#include?“arrayWGraph.h“
#include
using?namespace?std;
void?main()
{
cout?<“????????????????????=======================================================“?< cout?<“????????????????????==???????????????????????????????????????????????????==“?< cout?<“????????????????????==????????????????歡迎使用加權(quán)無向圖的開發(fā)類??????????==“?< cout?<“????????????????????==???????????????????????????????????????????????????==“?< cout?<“????????????????????=======================================================“?< cout?< cout?< cout?< cout?< cout?< cout?< cout?< cout?<“???????????????????????????????????????????????????????????????“?<“?作者:呂騰飛?薄建豪?張賽婭?王艷虹“;
Sleep(2500);
system(“cls“);
arrayWGraph?*g?=?new?arrayWGraph();
arrayWGraph?*prim?=?g->Prim();
while?(true)
{
cout?<“=======================================================“?< cout?<“==??????????????1:構(gòu)建計算機(jī)通信網(wǎng)絡(luò)?????????????????==“?< cout?<“==??????????????????——(用鄰接數(shù)組描述一個無向圖?)==“?< cout?<“==??????????????2:斷開兩臺計算機(jī)之間的通信???????????==“?< cout?<“==??????????????????——(刪除無向圖的一條邊)????????==“?< cout?<“==??????????????3.建立兩臺計算機(jī)之間的通信???????????==“?< cout?<“==??????????????????——(增加無向圖的一條邊)???????==“?< cout?<“==??????????????4.判斷通信網(wǎng)絡(luò)是否有環(huán)路(不用BFS)????==“?< cout?<“==??????????????5.判斷通信網(wǎng)絡(luò)是否有環(huán)路(用BFS)??????==“?< cout?<“==??????????????6.建立最小成本通信網(wǎng)絡(luò)(Prim)???????==“?< cout?<“==??????????????0:退出???????????????????????????????==“?< cout?<“=======================================================“?< int?n;
cin?>>?n;
switch?(n)
{
case?1:
cout?<“請輸入計算機(jī)的數(shù)目:“;
int?m1;
cin?>>?m1;
cout?<“請輸入通信鏈路的數(shù)目:“;
int?m2;
cin?>>?m2;
g->initialize(m1?m2);
for?(int?i?=?0;?i?numberOfVertices();?i++)
{
cout?<“請輸入第“?< int?m3;
cin?>>?m3;
g->insertver(i?m3);
}
for?(int?i?=?0;?i?numberOfEdges();?i++)
{
cout?<“請輸入第“?< int?m4;
cin?>>?m4;
cout?<“請輸入第“?< int?m5;
cin?>>?m5;
cout?<“請輸入第“?< int?m6;
cin?>>?m6;
g->insertEdge(m4?m5?m6);
}
cout?<“這個通信網(wǎng)絡(luò)為:“?< g->output();
break;
case?2:
cout?<“請輸入要刪除通信鏈路的第一臺計算機(jī)“;
int?m6;
cin?>>?m6;
cout?<“請輸入要刪除通信鏈路的第二臺計算機(jī)“;
int?m7;
cin?>>?m7;
g->eraseEdge(m6?m7);
cout?<“這個通信網(wǎng)絡(luò)為:“?< g->output();
break;
case?3:
cout?<“請輸入要增加通信鏈路的第一臺計算機(jī)“;
int?m8;
cin?>>?m8;
cout?<“請輸入要增加通信鏈路的第二臺計算機(jī)“;
int?m9;
cin?>>?m9;
cout?<“請輸入要增加通信鏈路的長度“;
int?m10;
cin?>>?m10;
g->insertEdge(m8?m9?m10);
cout?<“這個通信網(wǎng)絡(luò)為:“?< g->output();
break;
case?4:
if?(g->cycle1())
{
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-07-08?15:25??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\
?????文件??????295447??2020-07-08?15:24??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\《數(shù)據(jù)結(jié)構(gòu)與算法》三級項目報告.docx
?????目錄???????????0??2019-03-15?23:00??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\
?????目錄???????????0??2017-12-21?19:37??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\.vs\
?????目錄???????????0??2017-12-21?19:37??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\.vs\三級項目1221\
?????目錄???????????0??2017-12-21?19:37??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\.vs\三級項目1221\v14\
?????文件???????39424??2019-03-15?23:00??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\.vs\三級項目1221\v14\.suo
?????目錄???????????0??2017-12-21?22:38??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\Debug\
?????文件??????108544??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\Debug\三級項目1221.exe
?????文件??????566836??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\Debug\三級項目1221.ilk
?????文件?????1363968??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\Debug\三級項目1221.pdb
?????目錄???????????0??2017-12-21?22:38??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\
?????文件????????1330??2017-12-21?19:37??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221.sln
?????文件????29663232??2019-03-15?23:00??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221.VC.db
?????文件????????2856??2003-12-18?12:24??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\arrayQueue.h
?????文件????????6370??2017-12-21?21:47??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\arrayWGraph.h
?????目錄???????????0??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\
?????文件?????1117184??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\vc140.idb
?????文件??????536576??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\vc140.pdb
?????文件?????????240??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.log
?????目錄???????????0??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.tlog\
?????文件????????1282??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.tlog\CL.command.1.tlog
?????文件???????33736??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.tlog\CL.read.1.tlog
?????文件?????????384??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.tlog\CL.write.1.tlog
?????文件????????2058??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.tlog\li
?????文件????????3068??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.tlog\li
?????文件?????????368??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.tlog\li
?????文件?????????221??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\三級項目1221.tlog\三級項目1221.lastbuildstate
?????文件??????327649??2019-03-15?22:59??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\Debug\源.obj
?????文件?????????571??2017-12-11?08:37??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\graph.h
?????文件????????2979??2003-11-27?14:28??《數(shù)據(jù)機(jī)構(gòu)與算法》三級項目\三級項目1221\三級項目1221\myExceptions.h
............此處省略6個文件信息
- 上一篇:合工大編譯原理實驗報告
- 下一篇:錢能C++程序設(shè)計教程第二版
評論
共有 條評論