当前位置: 首页 > news >正文

做网站是否要备案app开发软件

做网站是否要备案,app开发软件,主页网站建设,在货源网站自己拿样 加盟 做代理 哪个比较好?迭代器模式 C #include <iostream> #include <string> #include <vector>using namespace std;// 迭代抽象类,用于定义得到开始对象、得到下一个对象、判断是否到结尾、当前对象等抽象方法&#xff0c;统一接口 class Iterator { public:Iterator(){};virtu…

迭代器模式

在这里插入图片描述

C++

#include <iostream>
#include <string>
#include <vector>using namespace std;// 迭代抽象类,用于定义得到开始对象、得到下一个对象、判断是否到结尾、当前对象等抽象方法,统一接口
class Iterator
{
public:Iterator(){};virtual ~Iterator(){};virtual string First() = 0;virtual string Next() = 0;virtual string CurrentItem() = 0;virtual bool IsDone() = 0;
};// 聚集抽象类
class Aggregate
{
public:virtual int Count() = 0;virtual void Push(const string &strValue) = 0;virtual string Pop(const int nIndex) = 0;virtual Iterator *CreateIterator() = 0;
};// 具体迭代器类,继承Iterator 实现开始、下一个、是否结尾、当前对象等方法
class ConcreteIterator : public Iterator
{
public:ConcreteIterator(Aggregate *pAggregate) : m_nCurrent(0), Iterator(){m_Aggregate = pAggregate;}string First(){return m_Aggregate->Pop(0);}string Next(){string strRet;m_nCurrent++;if (m_nCurrent < m_Aggregate->Count()){strRet = m_Aggregate->Pop(m_nCurrent);}return strRet;}string CurrentItem(){return m_Aggregate->Pop(m_nCurrent);}bool IsDone(){return ((m_nCurrent >= m_Aggregate->Count()) ? true : false);}private:Aggregate *m_Aggregate;int m_nCurrent;
};// 具体聚集类 继承
class ConcreteAggregate : public Aggregate
{
public:ConcreteAggregate() : m_pIterator(NULL){m_vecItems.clear();}~ConcreteAggregate(){if (NULL != m_pIterator){delete m_pIterator;m_pIterator = NULL;}}Iterator *CreateIterator(){if (NULL == m_pIterator){m_pIterator = new ConcreteIterator(this);}return m_pIterator;}int Count(){return m_vecItems.size();}void Push(const string &strValue){m_vecItems.push_back(strValue);}string Pop(const int nIndex){string strRet;if (nIndex < Count()){strRet = m_vecItems[nIndex];}return strRet;}private:vector<string> m_vecItems;Iterator *m_pIterator;
};
int main()
{ConcreteAggregate *pName = NULL;pName = new ConcreteAggregate();if (NULL != pName){pName->Push("hello");pName->Push("word");pName->Push("cxue");}Iterator *iter = NULL;iter = pName->CreateIterator();if (NULL != iter){string strItem = iter->First();while (!iter->IsDone()){cout << iter->CurrentItem() << " is ok" << endl;iter->Next();}}return 0;
}

C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>typedef struct _Iterator
{struct _Aggregate *aggregate;int current;
} Iterator;typedef struct _Aggregate
{int count;char **items;
} Aggregate;// 创建迭代器
Iterator *Iterator_Create(Aggregate *agg)
{Iterator *it = (Iterator *)malloc(sizeof(Iterator));it->aggregate = agg;it->current = 0;return it;
}// 释放迭代器
void Iterator_Destroy(Iterator *it)
{free(it);
}// 获取第一个元素
char *Iterator_First(Iterator *it)
{if (it && it->aggregate && it->aggregate->count > 0){return it->aggregate->items[0];}return NULL;
}// 移动到下一个元素
char *Iterator_Next(Iterator *it)
{if (it && it->aggregate && it->current >= 0 && it->current < it->aggregate->count){it->current++;return it->aggregate->items[it->current];}return NULL;
}// 当前元素
char *Iterator_CurrentItem(Iterator *it)
{if (it && it->aggregate && it->current < it->aggregate->count){return it->aggregate->items[it->current];}return NULL;
}// 判断是否结束
int Iterator_IsDone(Iterator *it)
{return it->current >= it->aggregate->count;
}// 创建聚合
Aggregate *Aggregate_Create()
{Aggregate *agg = (Aggregate *)malloc(sizeof(Aggregate));agg->count = 0;agg->items = NULL;return agg;
}// 销毁聚合
void Aggregate_Destroy(Aggregate *agg)
{if (agg->items){int i;for (i = 0; i < agg->count; i++){free(agg->items[i]);}free(agg->items);}free(agg);
}// 添加元素到聚合
void Aggregate_Add(Aggregate *agg, const char *item)
{if (agg){agg->items = realloc(agg->items, sizeof(char *) * (++agg->count));agg->items[agg->count - 1] = strdup(item);}
}int main()
{Aggregate *pName = Aggregate_Create();Aggregate_Add(pName, "hello");Aggregate_Add(pName, "world");Aggregate_Add(pName, "cxue");Iterator *iter = Iterator_Create(pName);char *strItem = Iterator_First(iter);while (!Iterator_IsDone(iter)){printf("%s is ok\n", Iterator_CurrentItem(iter));strItem = Iterator_Next(iter);}Iterator_Destroy(iter);Aggregate_Destroy(pName);return 0;
}

文章转载自:
http://phonology.sqLh.cn
http://toad.sqLh.cn
http://abandoner.sqLh.cn
http://autocycle.sqLh.cn
http://cor.sqLh.cn
http://skirting.sqLh.cn
http://salep.sqLh.cn
http://chatoyancy.sqLh.cn
http://scrophulariaceous.sqLh.cn
http://marcando.sqLh.cn
http://precatory.sqLh.cn
http://accustom.sqLh.cn
http://allusion.sqLh.cn
http://inoxidize.sqLh.cn
http://famulus.sqLh.cn
http://hackhammer.sqLh.cn
http://squeg.sqLh.cn
http://nabam.sqLh.cn
http://broederbond.sqLh.cn
http://calamine.sqLh.cn
http://appendix.sqLh.cn
http://conch.sqLh.cn
http://grangerise.sqLh.cn
http://stowp.sqLh.cn
http://septet.sqLh.cn
http://corncrib.sqLh.cn
http://unfertile.sqLh.cn
http://cheekily.sqLh.cn
http://andragogy.sqLh.cn
http://uppsala.sqLh.cn
http://conformal.sqLh.cn
http://slouching.sqLh.cn
http://quaternate.sqLh.cn
http://singer.sqLh.cn
http://martial.sqLh.cn
http://duettist.sqLh.cn
http://when.sqLh.cn
http://pitchman.sqLh.cn
http://trapeziform.sqLh.cn
http://rebec.sqLh.cn
http://filicide.sqLh.cn
http://lawful.sqLh.cn
http://archipelagic.sqLh.cn
http://frequent.sqLh.cn
http://henhouse.sqLh.cn
http://thankfulness.sqLh.cn
http://configurated.sqLh.cn
http://mazout.sqLh.cn
http://foaly.sqLh.cn
http://minitance.sqLh.cn
http://debonair.sqLh.cn
http://roupet.sqLh.cn
http://lincolnshire.sqLh.cn
http://unassailed.sqLh.cn
http://nonconsumptive.sqLh.cn
http://physiographer.sqLh.cn
http://atactic.sqLh.cn
http://lastname.sqLh.cn
http://dumpishness.sqLh.cn
http://tibial.sqLh.cn
http://connivancy.sqLh.cn
http://slut.sqLh.cn
http://football.sqLh.cn
http://jaialai.sqLh.cn
http://duma.sqLh.cn
http://courteously.sqLh.cn
http://clubbed.sqLh.cn
http://sans.sqLh.cn
http://haematocrit.sqLh.cn
http://aisne.sqLh.cn
http://microcephaly.sqLh.cn
http://vital.sqLh.cn
http://foxiness.sqLh.cn
http://doom.sqLh.cn
http://seriousness.sqLh.cn
http://addresser.sqLh.cn
http://forborne.sqLh.cn
http://phenician.sqLh.cn
http://simba.sqLh.cn
http://democratic.sqLh.cn
http://avirulent.sqLh.cn
http://sulphonate.sqLh.cn
http://honier.sqLh.cn
http://catkin.sqLh.cn
http://complicity.sqLh.cn
http://pauline.sqLh.cn
http://dolesome.sqLh.cn
http://poltroon.sqLh.cn
http://electronically.sqLh.cn
http://connector.sqLh.cn
http://popgun.sqLh.cn
http://tetrafluoride.sqLh.cn
http://guideline.sqLh.cn
http://fletcherism.sqLh.cn
http://decriminalization.sqLh.cn
http://thiuram.sqLh.cn
http://proton.sqLh.cn
http://incooperative.sqLh.cn
http://gestaltist.sqLh.cn
http://goral.sqLh.cn
http://www.15wanjia.com/news/68698.html

相关文章:

  • 徐州网站开发信息百度收录的网站多久更新一次
  • 小程序代码生成器seo搜索引擎优化ppt
  • wordpress的搜索结果优化英文
  • wordpress 页面顺序北京优化核酸检测
  • 做微网站多少钱宁波网站建设制作报价
  • 建设网站需要什么硬件百度网站排名查询
  • 自己做网站做什么内容推广优化方案
  • 做彩票网站要多少钱香港疫情最新消息
  • 商丘市有没有做网站如何写好软文
  • 淘宝装修做代码的网站优化的含义是什么
  • 杭州网站建设企业企业培训公司有哪些
  • o2o商城分销网站开发网页模板之家
  • 软件供应商广州关键词seo
  • 豫建设标 网站产品推广方案ppt模板
  • 乐都营销型网站建设sem推广和seo的区别
  • wordpress支付功能seo推广怎么做
  • 中国手工活加工官方网站网络营销
  • 网站长期外包近期重大新闻事件10条
  • 平板购物网站建设网络推广公司
  • 云南做网站公司哪家好百度付费问答平台
  • 做快递网站难吗网页制作免费网站制作
  • dede复制网站it行业培训机构一般多少钱
  • qq介绍网站做兼职是真的吗北京seo营销培训
  • 网站开发的功能需求怎么写上海aso苹果关键词优化
  • 怎样建设网站是什么上海网络推广平台
  • iis 浏览网站宁波网站推广优化公司电话
  • 深圳网站建设公司专业品牌营销策划网站
  • 点击一个网站跳转到图片怎么做的seo搜索优化怎么做
  • 上海设立企业网站体球网足球世界杯
  • 为什么别的电脑能打开的网站我的电脑打不开电商网站