- 1、本文档共3页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
数据结构,,会文
#includestdio.h#define true 1#define false 0#define m 3typedefstruct{char a[m];int top;}SeqStack;voidinita(SeqStack *s){s-top=-1;}int push(SeqStack *s, a x){if(s-top==m-1)return(false);s-top++;s-a[s-top]=x;return(true);}int pop(SeqStack *s, a *x){if(s-top==m-1)return(false);else { *x=s-a[s-top];s-top--;return(true); }}#define true 1#define false 0#define m 2typedefstruct{char b[m];int top;}voidinitb(SeqStack *s){s-top=-1;}int push(SeqStack *s, b y){if(s-top==m-1)return(false);s-top++;s-b[s-top]=x;return(true);}int pop(SeqStack *s,b *y){if(s-top==m-1)return(false);else { *y=s-b[s-top];s-top--;return(true); }}#define true 1#define false 0#define m 5typedefstruct{char c[m];int top;}voidinitc(SeqStack *s){s-top=-1;}int push(SeqStack *s,c z){if(s-top==m-1)return(false);s-top++;s-z[s-top]=x;return(true);}int pop(SeqStack *s, c z){if(s-top==m-1)return(false);else { *z=s-z[s-top];s-top--;return(true); }}void main(){inti,s=0,r=0;char c[5],a[3],b[2];char v=0;for(i=0;i3;i++)printf(%c,a[i],b[i]);for(i=0;i5;i++){s=(a[i]-v)+(b[i]-v)+r;r=s/10;}c[i]=s%10+v; for(i=0;i5;i++)printf(%c,c[i]);}
文档评论(0)