Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- using namespace std;
- void printArray(int arr[][3])
- {
- for (int Y = 0; Y < 3; Y++)
- {
- for (int x = 0; x < 3; x++)
- {
- cout << arr[x][Y] << " ";
- }
- cout << endl;
- }
- }
- int main() {
- srand(time(NULL));
- int arr[3][3];
- for (int y = 0; y < 3; y++)
- {
- for (int x = 0; x < 3; x++)
- {
- arr[x][y] = rand() % 9;
- }
- }
- printArray(arr);
- int temp;
- int num = 0;
- for (int y = 0; y < 3; y++)
- {
- for (int x = 0; x < 3; x++)
- {
- num = 0;
- for (int z = 0; z < 9; z++)
- {
- if (num != arr[x][y])
- {
- temp = num;
- }
- num++;
- }
- }
- }
- cout << "Number thats not in the array is : "<< num << endl;
- //printArray(arr);
- cin.get();
- cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement