⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lineedit.txt

📁 C++描述的数据结构内容,在C++builder的环境中运行,这是第一部分
💻 TXT
字号:
//单行编辑LINEEDIT.CPP
#include<iostream.h>
#include<iomanip.h>
#include<malloc.h>
#include<conio.h>
#define EOFILE '`'
typedef char Status;
typedef char SElemType;
#include "stack.cpp"
void LineEdit()
{ SqStack *S,*T;
  char str[1000];
  int strlen=0;
  char e;
  char ch;
  S->InitStack(&S);
  T->InitStack(&T);
  ch=getchar();
  while(ch!=EOFILE)
   {while(ch!=EOFILE&&ch!='\n')
     { switch(ch){
	case '#':
	  S->Pop(&ch);
	  break;
	case '@':
	  S->ClearStack();
	  break;
	default:
	  S->Push(ch);
          break;}
       ch=getchar();
     }
    if(ch=='\n') S->Push(ch);
      while(!S->StackEmpty())
       {S->Pop(&e);
        T->Push(e);}
      while(!T->StackEmpty())
       { T->Pop(&e);
         str[strlen++]=e;}
    if(ch!=EOFILE) ch=getchar();
   }
  cout<<"输出编辑后字符串:\n";
  str[strlen]='\0';
  cout<<'\n'<<str;
  S->DestroyStack();
  T->DestroyStack();
}
void main()
{cout<<"LINEEDIT.CPP运行结果:\n";
 cout<<"输入字符串,以输入字符`作为结束:\n";
 LineEdit();
 getch();}
LINEEDIT.CPP运行结果:
输入字符串,以输入字符`作为结束:
whli##ilr#e(s#*s)
outcha@  putchar(*s=#++);`
输出编辑后字符串:

while(*s)
  putchar(*s++);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -