コード例 #1
0
ファイル: main.c プロジェクト: Jejugo/Stack-in-C
//editor de texto que empilha caracteres
int editor_de_texto(void) {
    elem c, x;
    int erro;
    Pilha P;
    Create(&P);
    printf("Digite seu texto: ");
    while ((c=getche())!='\r') {
          if (c=='#') {
             Pop(&P,&x,&erro);
             if (erro) printf("(erro) ");
             else printf("(%c desempilhado) ",x);
          }
          else if (c=='@') {
               Empty(&P);
               printf("(pilha esvaziada) ");
          }
          else {
               Push(&P,&c,&erro);
               if (erro) printf("(erro) ");
          }
    }
    Inverter(&P);
    printf("\n\nDesempilhando tudo: ");
    
    while (!IsEmpty(&P)) {
          Pop(&P,&x,&erro);
          if (erro) printf("erro ");
//          else printf("%c ",x);
            else putchar(x);
    }
    putchar('\n');
    system("pause");
    return 0;
}
コード例 #2
0
ファイル: exe19.c プロジェクト: andersonsilvade/python_C
void main (){
     int i;
     celula *lst; //primeiro elemtento da lista - cabeça
     lst = malloc(sizeof(celula));
     lst->seg = NULL;
     
     for(i = 0; i < 3; i++) Inserir(i, lst);
     for(i = 0; i < 6; i++) Inserir(i, lst);
     
     Imprimir(lst);
     
     lst->seg = Inverter(lst);
     
     printf("\n\n");
     
     Imprimir(lst);
     
     system("pause");
     getch();

}
コード例 #3
0
ファイル: mainwindow.cpp プロジェクト: enriquezmark36/cenode
void MainWindow::on_Inverse_clicked()
{
    Inverter();
    cenode();
}