ssd5 网络拍卖 实验二
(1)关于这个实验的Apache的配置:将Apache放在新建的auction文件夹中,然后将这个文件夹放置在C盘跟目录下。
(2)编译器的配置:
<1>选用code bloks10.05版本。选择project -->Build option --> Linker Settings-->Add-->... 在codebolck的安装路径下找的这个文件夹 MinGW\lib ,然后在lib下找到libwsock32.a文件,添加即可。 <2>选用vc时的配置调整:project-->setting-->link-->在Category中选择Customize
下边选Force file output打钩,再在debug-->Program arguments 下填4000(如下图)
(3)将实验一中的Client.cpp Date.cpp Advertisement.cpp 导入实验2的工程中
Listing.h
View Code
#ifndef LISTING_H
#define LISTING_H
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <functional>
#include "Advertisement.h"
using namespace std;
class Listing;
class Listing {
protected:
typedef vector<Advertisement*> Container;
public:
typedef Container::iterator iterator;
protected:
Container objects;
public:
virtual Advertisement* operator[](const int& number);
virtual void add(Advertisement* ptr);
virtual iterator begin();
virtual iterator end();
};
#endif
Listing.cpp
View Code
#include"Listing.h"
void Listing::add(Advertisement* ptr)
{
objects.push_back(ptr);
}
vector<Advertisement*>::iterator Listing::begin()
{
return objects.begin();
}
vector<Advertisement*>::iterator Listing::end()
{
return objects.end();
}
Advertisement *Listing::operator[](const int& number)
{
vector<Advertisement*>::iterator it = objects.begin();
for(;it!=objects.end();it++)
if((*it)->getNumber()==number)
return *it;
return NULL;
}
Group.h
View Code
#ifndef GROUP_H
#define GROUP_H
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
#include <functional>
#include "Client.h"
using namespace std;
class Group;
class Group {
protected:
typedef vector<Client*> Container;
public:
typedef Container::iterator iterator;
protected:
Container objects;
public:
Client *operator[](const string& email);
virtual void add(Client* ptr);
virtual iterator begin();
virtual iterator end();
};
#endif
Group.cpp
View Code
#include "Group.h"
void Group::add(Client* ptr)
{
objects.push_back(ptr);
}
vector<Client*>::iterator Group::begin()
{
return objects.begin();
}
vector<Client*>::iterator Group::end()
{
return objects.end();
}
Client *Group::operator[](const string& email)
{
vector<Client*>::iterator it = objects.begin();
for(;it!=objects.end(); it++)
if((*it)->getEmail().compare(email)==0)
return *it;
return NULL;
}
posted on 2011-09-01 13:14 NewPanderKing 阅读(526) 评论(2) 编辑 收藏 举报