~SqList(){}; void Creat(); void PrintOut(); void Insert(int i,ElemType e); }; SqList::SqList(){length=0;} void SqList::Creat() {cout<<\cout<<\for(int k=0;k>elem[k]; } void SqList::PrintOut() { cout<<\ cout<<\ for(int k=0;klength) cout<<\ else {for(j=length;j>i;j--) elem[j]=elem[j-1]; elem[i]=e; length++; } } void main() {int i; ElemType e; SqList sq; sq.Creat(); sq.PrintOut(); cout<<\cin>>i; cout<<\cin>>e; sq.Insert(i,e); sq.PrintOut(); } void Push(ElemType e); ElemType Pop(); }; int SqStack::IsEmpty() {if(top==-1) return 1; else return 0; } void SqStack::Push(ElemType e) { if(top==MAXSIZE-1) cout<<\栈满溢出\ else{ top++; elem[top]=e; } } ElemType SqStack::Pop() { ElemType x; if(IsEmpty()){cout<<\栈为空不能出栈操作\ x=0; } else {x=elem[top]; top--; } return x; } void Conversion(int N,int r) { ElemType x; SqStack s; while(N) {s.Push(N%r); N=N/r; } while(!s.IsEmpty()) {x=s.Pop(); cout< 4.程序运行结果(及心得): cin>>n>>r; Conversion(n,r); }
6