?? lineedit.cpp
字號:
//單行編輯LINEEDIT.CPP
#include<iostream.h>
#include<iomanip.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#define EOFILE '`'
typedef char Status;
typedef char SElemType;
#include "stack.cpp"
void LineEdit()
{ SqStack *S,*T;
char str[100];
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();
}
printf("輸出編輯后字符串:\n");
str[strlen]='\0';
printf("%s\n",str);
S->DestroyStack();
T->DestroyStack();
}
void main()
{printf("LINEEDIT.CPP運行結(jié)果:\n");
printf("輸入字符串,以輸入字符`作為結(jié)束:\n");
LineEdit();
getch();getch();}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -