Advertisement
palmerstone

Queue

Sep 11th, 2011
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <math.h>
  6.  
  7. int main()
  8. {
  9. int t, i, j, k, l, a, b, c, d, x, y, z, ar[100];
  10. char ch, str[100];
  11.  
  12. scanf("%d", &t);
  13. getchar();
  14. j = 0, l = 0;
  15. for (i = 1; i <= t; i++)
  16. {
  17. ch = getchar();
  18. if (ch != 100)
  19. {
  20. scanf("%d", &ar[l++]);
  21. getchar();
  22. }
  23. else
  24. {
  25. if (j >= l) puts("Queue Empty");
  26. else
  27. {
  28. printf("%d\n", ar[j]);
  29. j++;
  30. }
  31. getchar();
  32. }
  33. }
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement