当前位置: 技术问答>linux和unix
sort算法的问题
来源: 互联网 发布时间:2015-11-16
本文导语: #include #include #include #include using namespace std; //自定义类型 struct MyStruct { unsigned long int id; unsigned long int cost; }; typedef MyStruct elemType; bool cmp(elemType&,elemType&); void Print(const elemType&); int main() { elemType temp...
#include
#include
#include
#include
using namespace std;
//自定义类型
struct MyStruct
{
unsigned long int id;
unsigned long int cost;
};
typedef MyStruct elemType;
bool cmp(elemType&,elemType&);
void Print(const elemType&);
int main()
{
elemType tempData;
unsigned long int id,cost;
ifstream fin("data.txt");
vector soureList;
while(fin>>id)
{
fin>>cost;
tempData.id=id;
tempData.cost=cost;
soureList.push_back(tempData);
}
cout
#include
#include
#include
using namespace std;
//自定义类型
struct MyStruct
{
unsigned long int id;
unsigned long int cost;
};
typedef MyStruct elemType;
bool cmp(elemType&,elemType&);
void Print(const elemType&);
int main()
{
elemType tempData;
unsigned long int id,cost;
ifstream fin("data.txt");
vector soureList;
while(fin>>id)
{
fin>>cost;
tempData.id=id;
tempData.cost=cost;
soureList.push_back(tempData);
}
cout