You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

41 lines
541 B

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stdint.h>
  4. /* rearrange things so instead of
  5. 0 1
  6. 0 2
  7. 0 3
  8. 1 4
  9. 1 5
  10. 1 6
  11. we just print
  12. 0 1 2 3
  13. 1 4 5 6
  14. */
  15. int main(void)
  16. {
  17. uint32_t dac, adc;
  18. uint32_t olddac;
  19. int first = 1;
  20. while(1) {
  21. scanf("%d %d", &dac, &adc);
  22. if (feof(stdin))
  23. break;
  24. if (first) {
  25. printf("%ld ", dac);
  26. first = 0;
  27. } else if (dac != olddac) {
  28. printf("\n%ld ", dac);
  29. } else {
  30. printf(" ");
  31. }
  32. printf("%ld", adc);
  33. olddac = dac;
  34. }
  35. printf("\n");
  36. return 0;
  37. }