Exemplo n.º 1
0
int main() {
	Stack *pila1;
	pila1 = stack_create();
	
	stack_data(pila1)[0] = 2;
	stack_data(pila1)[1] = 8;
	stack_data(pila1)[2] = 14;
	stack_back(pila1) = 2;

	pila1 = stack_push(pila1,4);



	pila1 = stack_pop(pila1);
	stack_print(pila1);	

	int i;
	for(i = 0; i<=stack_back(pila1) && stack_back(pila1) != stack_maxstack(pila1) ; i++)
				stack_data(pila)[i] = 3;



	pila1 = stack_reverse(pila1);
	stack_print(pila1);

	stack_destroy(pila1);
	


}
Exemplo n.º 2
0
int main(void){

    stack* stacky = stack_create();

    stack_push(stacky, 82.1);
    stack_push(stacky, 51.3);
    stack_push(stacky, 89.9999);


    stack_print(stacky);
    stack_reverse(&stacky);
    
    stack_print(stacky);
    stack_destroy(stacky);
}
Exemplo n.º 3
0
void draw_stack(struct stack *stack) {
  if (stack_empty(stack)) {
    box(stack->card->frame->window, 0, 0);
    if (stock_stack(stack)) {
      if (game.passes_through_deck_left >= 1) {
        mvwprintw(stack->card->frame->window, 2, 3, "O");
      } else {
        mvwprintw(stack->card->frame->window, 2, 3, "X");
      }
    }
    wrefresh(stack->card->frame->window);
  } else {
    if (maneuvre_stack(stack)) {
      struct stack *stack_reversed_stack = stack_reverse(stack);
      for (struct stack *i = stack_reversed_stack; i; i = i->next) {
        draw_card(i->card);
      }
      stack_free(stack_reversed_stack);
    } else {
      draw_card(stack->card);
    }
  }
}