📄 city.cpp
字号:
// City.cpp: implementation of the CCity class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Project.h"
#include "City.h"
#include "Global.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#include "Global.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCity::CCity()
{
for(int i = 0; i <= NumOfCity - 1; i++)
{
for(int j = 0; j <= NumOfCity - 1; j++)
{
tao[i][j] = tao_0;
}
}
for(int m = 0; m <= NumOfCity - 1; m++)
{
for(int n = 0; n <= NumOfCity - 1; n++)
{
derta_t[m][n] = derta_tao;
tao[m][n] = tao_0;
// yita[m][n] = getYita(m, n);
}
}
}
CCity::~CCity()
{
}
double CCity::getDistant(int i, int j)
{
int temp[NumOfCity][NumOfCity];
FILE *fp;
fp = fopen("distant.txt", "r+");
for(int m = 0; m <= NumOfCity - 1; m++)
{
for(int n = 0; n <= NumOfCity - 1; n++)
{
fscanf(fp, "%d", &temp[m][n]);
}
}
double result;
result = temp[i][j];
return result;
}
double CCity::getYita(int i, int j)
{
CCity city;
double result;
if(city.getDistant(i, j) == 0)
{
result = 0;
}
else
{
result = 1 / city.getDistant(i, j);
}
return result;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -