Advertisement
Guest User

Untitled

a guest
May 6th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. int main(int argc,const char *argv[])
  2. {
  3. FILE *src = input_from_args(argc, argv);
  4.  
  5. if (src == NULL)
  6. {
  7. printf("%s", "Invalid Source");
  8. exit(EXIT_FAILURE);
  9. }
  10. else
  11. {
  12. struct stack * equation = NULL;
  13. equation = (struct stack*)malloc(sizeof(struct stack));
  14. equation -> top = -1;
  15.  
  16. int i;
  17. int c;
  18. while( argv[i] != NULL)
  19. {
  20. c = *argv[i];
  21. i++;
  22. push(equation,c);
  23. }
  24.  
  25. if(strcmp(argv[1],"-e") == 0)
  26. {
  27. evaluate(equation);
  28. printf("%i n", pop(equation));
  29. }
  30. else if(strcmp(argv[1],"-c") == 0)
  31. {
  32. convert(equation);
  33. }
  34. else if(strcmp(argv[1],"-g") == 0)
  35. {
  36. other(equation);
  37. }
  38. }
  39.  
  40. return EXIT_SUCCESS;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement