Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <ctime>
  3. using namespace std;
  4. void printArray(int arr[][3])
  5. {
  6. for (int Y = 0; Y < 3; Y++)
  7. {
  8. for (int x = 0; x < 3; x++)
  9. {
  10. cout << arr[x][Y] << " ";
  11. }
  12. cout << endl;
  13. }
  14. }
  15.  
  16. int main() {
  17. srand(time(NULL));
  18. int arr[3][3];
  19. for (int y = 0; y < 3; y++)
  20. {
  21. for (int x = 0; x < 3; x++)
  22. {
  23. arr[x][y] = rand() % 9;
  24. }
  25. }
  26. printArray(arr);
  27. int temp;
  28. int num = 0;
  29. for (int y = 0; y < 3; y++)
  30. {
  31. for (int x = 0; x < 3; x++)
  32. {
  33. num = 0;
  34. for (int z = 0; z < 9; z++)
  35. {
  36. if (num != arr[x][y])
  37. {
  38. temp = num;
  39. }
  40. num++;
  41. }
  42.  
  43. }
  44. }
  45. cout << "Number thats not in the array is : "<< num << endl;
  46. //printArray(arr);
  47.  
  48. cin.get();
  49. cin.get();
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement