// DVDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DV.h"
#include "DVDlg.h"
#include <list>
struct Table
{
CString id;
int distance;
CString father;
};
class Rout
{
public:
Rout();
virtual ~Rout();
void set(Table);
void setname(CString);
void update();
bool IsIn(Table);
int Postion(Table);
list <Table,Table&> rout;
CString name;
};
list<Rout> RoutTab;
void Rout::setname(CString s)
{
name=s;
}
int Rout::Postion(Table a)
{
int x=0;
list<Table,Table&>::iterator it=rout.begin();
while (it!=rout.end())
{
x++;
if (it->id==a.id)
{
break;
}
else
{
it++;
}
}
return x;
}
void Rout::set(Table a)
{
rout.push_back(a);
}
bool Rout::IsIn(Table a)
{
bool flag=false;
list<Table,Table&>::iterator it=rout.begin();
while (it!=rout.end())
{
if (it->id==a.id)
{
flag=true;
break;
}
else
{
it++;
}
}
return flag;
}
void Rout::update()
{
list<Table,Table&>::iterator it=rout.begin(); //it遍历A表
//
#include "stdafx.h"
#include "DV.h"
#include "DVDlg.h"
#include <list>
struct Table
{
CString id;
int distance;
CString father;
};
class Rout
{
public:
Rout();
virtual ~Rout();
void set(Table);
void setname(CString);
void update();
bool IsIn(Table);
int Postion(Table);
list <Table,Table&> rout;
CString name;
};
list<Rout> RoutTab;
void Rout::setname(CString s)
{
name=s;
}
int Rout::Postion(Table a)
{
int x=0;
list<Table,Table&>::iterator it=rout.begin();
while (it!=rout.end())
{
x++;
if (it->id==a.id)
{
break;
}
else
{
it++;
}
}
return x;
}
void Rout::set(Table a)
{
rout.push_back(a);
}
bool Rout::IsIn(Table a)
{
bool flag=false;
list<Table,Table&>::iterator it=rout.begin();
while (it!=rout.end())
{
if (it->id==a.id)
{
flag=true;
break;
}
else
{
it++;
}
}
return flag;
}
void Rout::update()
{
list<Table,Table&>::iterator it=rout.begin(); //it遍历A表