Comments

Wednesday, October 17, 2012

Using array find element in index of array taken input from user.

Posted by at 8:59 AM Read our previous post


Object  
      Using array find element in index of array taken input from user.

Source code

#include<iostream>
using namespace std;
void main()

{

       int enter;

       int find[12];

       cout << "Enter Numbers to save in array" << endl;

       for(int enter_loop = 0; enter_loop < 12; enter_loop ++)

       {

              cin >> find[enter_loop];

       }

       cout << "Enter a Number you want to see the address of number in array\n";

       cin >> enter;

       int loop;

       for(loop = 0; loop <= enter; loop++)

       {

                     if(find[loop] == enter)

                     {

                           cout << "The Address is: " << loop;          

                           break;

                     }

       }

}

Output

1 comment:

  1. okay you have problem to show the address of the number you enter in array.
    i have update the codes now it working fine,but remember that

    1- Enter the number you enter in Array,and it display its address.
    2- Array always start form zero so for 1st value its address is 0 and for second is 1 and so on.

    ReplyDelete

Note: Only a member of this blog may post a comment.

Popular Posts

Labels

© Codepirate is powered by Blogger - Template designed by Stramaxon - Best SEO Template