Exemplo n.º 1
0
Arquivo: npi.c Projeto: fave-r/42Sh
t_tree		*npi(t_token *token, char *str, t_env *env)
{
  t_npi		npi;

  npi.tree = NULL;
  npi.stack = NULL;
  npi.output = NULL;
  token = exotic_and_var(token, env);
  if (!token)
    return (NULL);
  if (!token->next)
    return (createnode(NULL, token->token));
  while (token)
    {
      my_stack(token->token, &npi.stack, &npi.output);
      token = token->next;
    }
  while (npi.stack)
    {
      make_tree(&npi.output, npi.stack->data);
      npi.stack = npi.stack->next;
    }
  npi.tree = npi.output->tree;
  delete_npi(npi.stack, npi.output);
  if (check_full_tree(npi.tree, str) == 1)
    return (npi.tree);
  return (NULL);
}
Exemplo n.º 2
0
int main()
{
    std::auto_ptr <App> my_stack(new App());
    try
    { 
        long a1 = std::clock();
        std::cout << "Time Start: " << a1 << "\n";

        my_stack->Run();

        long b1 = std::clock();
        std::cout << "Time END: " << b1 << "\n\n";
        std::cout << "Open file Time TOTAL: " << (b1-a1)/1000.0 << " sec.\n";
    }
    catch(std::runtime_error)
    {
        std::cout << "EXCEPTION_EXECUTE_HANDLER\n";
    }
    /*
    __except (EXCEPTION_EXECUTE_HANDLER)
    {
        std::cout << "EXCEPTION_EXECUTE_HANDLER has number - " << EXCEPTION_EXECUTE_HANDLER << "\n";
    }    
    */
    
    //std::cout << "\nPress any key to exit...\n";
    system("PAUSE");
    
    return 1;
}
Exemplo n.º 3
0
int main(int argc, const char * argv[]) {
    
    stack<char> my_stack(3);
    my_stack.push('h');
    my_stack.push('e');
    my_stack.push('l');
    my_stack.push('l');
    my_stack.push('o');
    my_stack.push('w');
    my_stack.push('o');
    my_stack.push('r');
    my_stack.push('l');
    my_stack.push('d');
    
    
    
    std::cout << "my stack has " << my_stack.numberOfSubstacks() << " substacks at the moment\n";
    
    my_stack.pop();
    my_stack.pop();
    my_stack.pop();
    
    std::cout << "my stack has " << my_stack.numberOfSubstacks() << " substacks at the moment\n";
    
    my_stack.pop();
    my_stack.pop();
    my_stack.pop();
    
    std::cout << "my stack has " << my_stack.numberOfSubstacks() << " substacks at the moment\n";
    
    my_stack.pop();
    my_stack.pop();
    my_stack.pop();
    
    std::cout << "my stack has " << my_stack.numberOfSubstacks() << " substacks at the moment\n";
    
    my_stack.pop();
    my_stack.pop();
    my_stack.pop();
    
    std::cout << "my stack has " << my_stack.numberOfSubstacks() << " substacks at the moment\n";
    
    return 0;
}