Advertisement
Guest User

lab26_main

a guest
May 29th, 2015
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "udt.h"
  3. #include "sort.h"
  4.  
  5.  
  6.  
  7. void main() {
  8.  
  9. // переменную-очередь
  10. queue q;
  11. create(&q);
  12. int n;
  13. //Заполнить очередь данными
  14. printf("enter the number of elements (less than 20)\n");
  15. scanf("%d",&n);
  16. int i;
  17. printf("enter the key and additional number for every number\n");
  18. data_type data;
  19. for (i=0; i<n; i++)
  20. {
  21. scanf("%d %d",&data.key, &data.value);
  22. printf("\n");
  23. push_back(&q,data);
  24. }
  25. /* print(&q);
  26. for (i=0; i<n; i++)
  27. { data_type v1=pop_front(&q);
  28. printf("%d-> %d\n", v1.key,v1.value);
  29. }
  30. */ //Распечатать содержимое очереди
  31. print(&q);
  32.  
  33. //Отсортировать очередь
  34. int count = 0;
  35. printf("count address = %d\n", &count);
  36. sort(&q, &count);
  37. printf("\n");
  38. //Распечатать новое содержимое очереди
  39. print(&q);
  40.  
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement