#include "stdafx.h" #include using namespace std; // A is the array that contains nx5 numbers // x is the number to search for in the array // n is the number of rows in the array int findElementIn2DArray(const int A[][5], int x, const int n) { for (int i = 0; i < n; i++) for (int j = 0; j < 5; j++) if (A[i][j] == x) { return 1; } return 0; } int main() { int A[3][5] = { { 1,2,3,4,5 } ,{ 10,110,12,13,14 },{ 20,21,22,23,24 } }; int elevenFound = findElementIn2DArray(A, 11, 3); cout << "Eleven was " << ((elevenFound) ? "" : "NOT ") << "found." << endl; return 0; }