求设计一个程序求出出列顺序的编程(用VisualC++的方法)
一、求设计一个程序求出出列顺序的编程(用VisualC++的方法)
原创:
“ListNode”头文件
class ListNode
{
//friend class LinList;friend class CirList;private: ListNode *next;public: int data; ListNode(ListNode *ptrnext=NULL); ListNode(const int &item,ListNode *ptrNext=NULL); ~ListNode(){};
};
ListNode::ListNode(ListNode *ptrNext):next(ptrNext){}
ListNode::ListNode(const int &item,ListNode *ptrNext)
{
data=item;next=ptrNext;
}
“CirList”头文件
#include”ListNode.h”
class CirList
{

private:
ListNode *head;int size;ListNode *currPtr;
public:
CirList(void);~CirList(void);int ListSize(void) const;ListNode *Index(int pos);void Insert(const int &item,int pos);int Delete(int pos);int GetData(int pos);int ListEmpty(void) const;void ClearList(void);ListNode *Reset(int pos=0);ListNode *Next(void);int EndOfList(void) const;int NextEndOfList() const;int DeleteAfter();
};
CirList::CirList()
{
head=new ListNode();head->next=head;size=0;
}
CirList::~CirList(void)
{
ClearList();delete head;
}
int CirList::ListSize(void) const
{
return size;
}
int CirList::ListEmpty(void) const
{
if(size<=0) return 1;else return 0;
}
void CirList::Insert(const int &item,int pos)
{
if(possize){ cout<<"参数pos越界出错!"next=newNode; size++; } int CirList::Delete(int pos) { if(possize-1) { cout<<"参数pos越界出错!"next=p->next->next; int data=q->data; delete q; size--; return data; } int CirList::GetData(int pos) { if(pospos-1) { cout<<"参数pos越界出错!"<data; } listnode *cirlist::index(int pos) { if(possize) { cout<<"!"next; while(p !=head) { pl=p; p=p->next; delete pl; } size=0; } ListNode *CirList::Reset(int pos) { if(head==NULL) return NULL; if(pos=size) { cout<<"参数pos越界出错!"next; ListNode prevPtr=head; for(int i=0;inext; } } return currPtr; } ListNode *CirList::Next(void) { //if(currPtr !=NULL) currPtr=currPtr->next; currPtr=currPtr->next; return currPtr; } int CirList::EndOfList(void) const { if(currPtr==head) return 1; else return 0; } int CirList::NextEndOfList() const { if(currPtr->next==head)return 1; else return 0; } int CirList::DeleteAfter() { ListNode *p=currPtr->next; currPtr->next=p->next; int data=p->data; delete p; size--; return data; } "Josephus.cpp" #include #include #include"CirList.h" void Josephus(CirList &CList,int n,int m) { ListNode *p; cout<<"删除次序依次为:"n; cout<>m; for(int i=0;idata<<"`"; p=myCirList.Next(); } cout<</p>
二、POS机跳码是什么意思
刷卡机跳码的意思:
在银行的系统里,对不同行业的商户有不同的编号,最早的时候比如超市的费率是0.38,服装类0.78,餐饮娱乐1.25,部分商户为了少掏手续费,名字是餐饮的,实际套用的是0.38的编码,这就是所谓的跳码。
扩展资料:
避免刷卡被套码和跳码
1、首先持卡人要关注每笔交易在交易完成后仔细查看交易单据确认无误后再签字确认。如果刷卡交易完成后确认遭遇了跳码,可第一时间拨打银行客服电话反映该情况。
2、各银行的处理方式不同持卡人要据理力争必要时可进行信用卡调单处理。如果以上要求不成功,可要求银行手动添加该笔交易对应的信用卡积分尽量挽回跳码损失。
参考资料来源:百度百科-跳码
参考资料来源:百度百科-pos机