I need to create A program That makes a 12x10 Array Grid Filled With Random Numbers From 0-99.

Then I need To Allow The User To Input A Number Between 0-99 And Then The program will then search through the array and count how many of the users number there is inside the array.

I need Help With The Last part As I Do Not Know How To Start It.. Please Help!

Code:

//Assignment 20 Program 3
#include <iostream>
using namespace std;
int main()

{
    int input;
    int number;
    int row=0;
    int col=0;
    int Array [12][12];
    srand(time(NULL));

//PrintArray

    for(row=0;row<12; row++)
    {          
        for(col=0;col<10; col++)
        {        
        {       
            Array[row][col]= rand() % (99-0) + 0;
        }
            cout << Array[row][col] << "\t";
        }     
        cout << ""<<endl<<endl;               
    }


cout << "--------------------------------------------------------------------------------"<< endl << endl;

    cout << "Enter Number Between 0-99 To Search In The Array: ";
    cin >> input;
    cout << "" << endl;


system ("pause");
return 0;
}

Instead of printing the array(element lookup) at that position, check if the element at that position is equal to the one that the user entered, if it is then increase a count, if not take element at next position and so on until you go through the entire array

after the array is checked, just print out the count value

Edited 2 Years Ago by Slavi

This article has been dead for over six months. Start a new discussion instead.