Advertisement
Guest User

Untitled

a guest
May 19th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "stack.h"
  3. #include "queue.h"
  4. #include <string.h>
  5. #define N 3
  6.  
  7. int MSB(int num) {
  8. {
  9. while (num != 0)
  10. {
  11. num = num % 10;
  12. num /= 10;
  13. }
  14. return num;
  15. }
  16.  
  17. void main()
  18. {
  19.  
  20. queue q1;
  21. int i, count = 0;
  22. int b;
  23. queue_init(&q1);
  24. printf("Give me numbers\n");
  25. do {
  26. scanf("%d", &b);
  27. if (b != 0)
  28. {
  29. MSB(b);
  30. enqueue(&q1, b);
  31. count++;
  32.  
  33. }
  34.  
  35. } while (count < N); // קליטה
  36. while (count != 0)
  37. {
  38. printf("%d ", dequeue(&q1));
  39. count--;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement