#includetypede" /> #includetypede" />

全文预览

2012《数据结构》上机实验报告链表

上传者:梦溪 |  格式:doc  |  页数:13 |  大小:266KB

文档介绍
;as.PrintOut();}break;case3:{cout<<"\n被删除的姓名="; cin>>e.name; as.Delet(e);as.PrintOut();}break;default:break;}}while(k>=1&&k<4);cout<<"\n再见!";return0;}第三题代码#include<iostream.h>#include<iomanip.h>typedefintElemType;//数据元素的类型constintMAXSIZE=100;//数组的容量classSqStack{private:ElemTypeelem[MAXSIZE];inttop;public:SqStack();~SqStack(){};voidSqStack::push(ElemTypee);ElemTypeSqStack::pop();voidSqStack::PrintOut();intSqStack::IsEmpty();?voidf(ElemTypeN,ElemTypeM);};voidSqStack::f(ElemTypeN,ElemTypeM){?SqStacks;ElemTypee;?while(N)?{ s.push(N%M); N=N/M;?}?while(!s.IsEmpty())?{ e=s.pop(); if(e>=10) { e=e%10; switch(e) { case1:cout<<"b"<<endl;break;case2:cout<<"c"<<endl;break;case3:cout<<"d"<<endl;break;case4:cout<<"e"<<endl;break; case5:cout<<"f"<<endl;break;?default:cout<<"a"<<endl;break; } }elsecout<<e;

收藏

分享

举报
下载此文档