資源簡(jiǎn)介
隨機(jī)早檢測(cè)算法的c++代碼實(shí)現(xiàn),運(yùn)行環(huán)境visual studio
代碼片段和文件信息
//?Red.cpp?:?定義控制臺(tái)應(yīng)用程序的入口點(diǎn)。
//
#include?“stdafx.h“
#include“queue“
#include“cstdlib“
#include“iostream“
#include“windows.h“
#include“string“
#include“ctime“
#include“vector“
using?namespace?std;
int?lose=0;
float?getp(float?pmaxfloat?laint?thmaxint?thminint?count)//計(jì)算丟棄報(bào)文概率
{
float?ptemp=pmax*(la-thmin)/(thmax-thmin);
return?(ptemp/(1-count*ptemp));
}
float?getla(float?oldlafloat?newla)//計(jì)算平均長(zhǎng)度
{
return?((1-0.125)*oldla+0.125*newla);
}
void?initq(priority_queue?&qstring?s)//初始化發(fā)送端
{
while(q.size()<25)
{
q.push(s);
}
}
void?trans(priority_queue?&apriority_queue?&qfloat?laint?thmaxint??thminfloat?pint?&countstring?s)
{
if(la0)
{
q.push(a.top());
cout<<“接收“< a.pop();
}
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件??????98304??2009-11-24?21:18??Red\debug\Red.exe
?????文件????1076224??2009-11-24?21:18??Red\debug\Red.pdb
?????文件???????8066??2009-11-24?21:18??Red\Red\Debug\BuildLog.htm
?????文件?????????67??2009-11-24?21:18??Red\Red\Debug\mt.dep
?????文件????????403??2009-11-24?16:43??Red\Red\Debug\Red.exe.em
?????文件????????468??2009-11-24?16:43??Red\Red\Debug\Red.exe.em
?????文件????????385??2009-11-24?21:18??Red\Red\Debug\Red.exe.intermediate.manifest
?????文件?????385290??2009-11-24?21:18??Red\Red\Debug\Red.obj
?????文件??????10933??2009-11-24?16:43??Red\Red\Debug\stdafx.obj
?????文件?????258048??2009-11-24?21:18??Red\Red\Debug\vc80.pdb
?????文件????????926??2009-11-24?16:39??Red\Red\ReadMe.txt
?????文件???????3124??2009-11-24?21:18??Red\Red\Red.cpp
?????文件???????4475??2009-11-24?16:39??Red\Red\Red.vcproj
?????文件???????1421??2009-11-25?10:08??Red\Red\Red.vcproj.GREAT-JIAJIA.JIAJIA.user
?????文件???????1411??2009-11-24?21:31??Red\Red\Red.vcproj.sdwh105.Administrator.user
?????文件???????1411??2009-11-24?20:31??Red\Red\Red.vcproj.sdwh106.Administrator.user
?????文件????????208??2009-11-24?16:39??Red\Red\stdafx.cpp
?????文件????????276??2009-11-24?16:39??Red\Red\stdafx.h
?????文件????3959808??2009-11-25?10:09??Red\Red.ncb
?????文件????????874??2009-11-24?16:39??Red\Red.sln
????..A..H.?????19968??2009-11-25?10:08??Red\Red.suo
?????目錄??????????0??2009-11-27?18:13??Red\Red\Debug
?????目錄??????????0??2009-11-27?18:13??Red\debug
?????目錄??????????0??2009-11-27?18:13??Red\Red
?????目錄??????????0??2009-11-27?18:13??Red
-----------?---------??----------?-----??----
??????????????5832090????????????????????25
評(píng)論
共有 條評(píng)論