[gtranslate]

finding-index-of-element-in-array

Using Array Finding Element in Index of Array | [*Solved*] | C++

Source code

#include<iostream>
using namespace std;
int main()
{
       int enter;
       int find[6];
       cout << “Enter Numbers to save in array” << endl;
       for(int i = 0; i < 6; i ++)
       {
              cin >> find[i];
       }
       cout <<“Enter a Number you want to see the address of number in array\n”;
       cin >> enter;
       int j;
       for(j = 0; j <= 6; j++)
       {
                     if(find[j] == enter)
                     {
                           cout << “The Address is: ” << j+1;          
                           break;
                     }
       }
                return 0;
}

Output

finding index of element in array