Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <thread>
  4. /*
  5. const static int sudSize = 9;
  6.  
  7. const int count(int* list, int item) {
  8. int n = 0;
  9. for (int i = 0; i < sudSize; i++)
  10. if (list[i] == item)
  11. n++;
  12. return n;
  13. }
  14.  
  15. const void validateRow(int* row, int id) {
  16. for (int i = 0; i < sudSize; i++)
  17. // if an item is not exactly 1x present in list, return false
  18. if (count(row, row[i]) != 1) {
  19. std::cout << "Row " << id << " is incorrect." << std::endl;
  20. return;
  21. }
  22. }
  23. */
  24. int main()
  25. {
  26. /*const int sudoku[sudSize][sudSize] = {
  27. {1, 2, 3, 4, 5, 6, 7, 8, 9},
  28. {9, 1, 2, 3, 4, 5, 6, 7, 8},
  29. {8, 9, 1, 2, 3, 4, 5, 6, 7},
  30. {7, 8, 9, 1, 2, 3, 4, 5, 6},
  31. {6, 7, 8, 9, 1, 2, 3, 4, 5},
  32. {5, 6, 7, 8, 9, 1, 2, 3, 4},
  33. {4, 5, 6, 7, 8, 9, 1, 2, 3},
  34. {3, 4, 5, 6, 7, 8, 9, 1, 2},
  35. {2, 3, 4, 5, 6, 7, 8, 9, 1}
  36. };
  37. std::thread t[sudSize];
  38.  
  39. for (int i = 0; i < sudSize; i++)
  40. t[i] = std::thread(validateRow, sudoku[i]);
  41.  
  42. for (int i = 0; i < sudSize; i++)
  43. t[i].join();*/
  44. std::cout << "test";
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement