Wednesday, December 2, 2020

Take 10 integer inputs from user and store them in an array. Again ask user to give a number. Now, tell user whether that number is present in array or not with Eaglesoft

 


#include<iostream>
using namespace std;
int main()
{
    int _input[10],c=0,n,i=0,f=0;
    
    // Take input from user
    while(c<10)
    {
        cout<<"Enter your Number "<<c+1<<" : "<<endl;
        cin>>_input[c];
        c++;
    }
    // Take test of programmer
    cout<<"Hello Programmer we are going to take a test of your knowledge"<<endl;
    cout<<"Enter a value to guess that are present in array input or not"<<endl;
    cin>>n;
    while(i<10)
    {
        if(n==_input[i])
        f=1;
        i++;
    }
    if(f==1)
    cout<<"Great you are smart programmer"<<endl;
    else
    {
        cout<<"Sorry programmer try again after drinking a cup of tea"<<endl;
    }
    // Show output that are store in an array 
    // int k=0;
    // while(k<10)
    // {
    //     cout<<"Your entered "<<k+1<<"number is: "<<_input[k]<<endl;
    //     k++;
    // }
    cout<<"*********This is Eaglesoft programmer*********"<<endl;
    return 0;
}

No comments:

Post a Comment