find values in user entered array

前端 未结 3 912
生来不讨喜
生来不讨喜 2021-01-28 22:53

i am trying to find any user entered value in a array which the user has previously entered the values of. I made the following for finding which values were entered in array bu

3条回答
  •  清酒与你
    2021-01-28 23:21

    I think this answer will solve your problem.. :)

    #include
    #include
    
    using namespace std;
    
    void main ()
    {
        int a[10];
        for(int i=0;i<10;i++)
        {
            cout<<"enter value : ";
            cin>>a[i];
        }
        int random;
        cin>>random;
        int flag=0;
        for(int i=0;i<10;i++)
        {
           if(a[i]==random)
           {
             flag=1;
             cout<<"Found at a["<

提交回复
热议问题