正在加载图片...
C语言程序设计 清华大学郑莉安颖莲 栈的应用举例—; 行编辑程序 接收用户输入的程序或数据,存入用户的数据区 “#”表示退格符,“@”表示退行符。 void LineEdit() InitStack(S); ch=getchar ( while (ch!=EOF) while(ch!=EOF &ch!='\n') switch (ch) case '#Pop(S,c); case @'ClearStack(S); default:Push(S,ch); ch=getchar ( ClearStack(S); if(ch!=EOF)ch=getchar(); DestroyStack(S); Page 6C语言程序设计 清华大学 郑莉 安颖莲 Page 6 栈的应用举例——行编辑程序 • 接收用户输入的程序或数据,存入用户的数据区 “#”表示退格符,“@”表示退行符。 void LineEdit() { InitStack(S); ch=getchar(); while(ch!=EOF) { while(ch!=EOF && ch!='\n') { switch (ch) { case '#':Pop(S,c); case '@':ClearStack(S); default:Push(S,ch); } ch=getchar(); } ClearStack(S); if(ch!=EOF) ch=getchar(); } DestroyStack(S); }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有