Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "stack.h"
- #include "queue.h"
- #include <string.h>
- #define N 3
- int MSB(int num) {
- {
- while (num != 0)
- {
- num = num % 10;
- num /= 10;
- }
- return num;
- }
- void main()
- {
- queue q1;
- int i, count = 0;
- int b;
- queue_init(&q1);
- printf("Give me numbers\n");
- do {
- scanf("%d", &b);
- if (b != 0)
- {
- MSB(b);
- enqueue(&q1, b);
- count++;
- }
- } while (count < N); // קליטה
- while (count != 0)
- {
- printf("%d ", dequeue(&q1));
- count--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement