SHARE
TWEET

Untitled

a guest Feb 18th, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void multiples_entries() {
  2.     int num;
  3.  
  4.     scanf("%d", &num);
  5.     printf("%d ", num);
  6.  
  7.     if(num == -1000) {
  8.         printf("\n");
  9.         return;
  10.     }
  11.     else {
  12.         int i = 0;
  13.         char character, input[1000];
  14.         stack *stack = create_stack();
  15.         while(1) {
  16.             scanf("%c", &character);
  17.  
  18.                 if(character != '\0' && character != ' ') {
  19.                 input[i++] = character;
  20.  
  21.                 if(character == '(') {
  22.                     push(stack, '(');
  23.                 }
  24.                 else if(character == ')') {
  25.                     pop(stack);
  26.  
  27.                     if(stack -> top == NULL) {
  28.                         break;
  29.                     }
  30.                 }
  31.             }
  32.         }
  33.  
  34.         input[i++] = '\0';
  35.  
  36.         //int aux = 0;
  37.         //int *j = &aux;
  38.  
  39.         //bt *bt = create_empty_binary_tree();
  40.         //bt = read(bt, input, j);
  41.  
  42.         /*if(path(bt, num, 0)) {
  43.             printf("sim\n");
  44.         }
  45.         else {
  46.             printf("nao\n");
  47.         }*/
  48.  
  49.         //print_pre_order(bt);
  50.         printf("%s\n", input);
  51.      
  52.         multiples_entries();
  53.     }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top