Untitled

 avatar
unknown
plain_text
a year ago
447 B
7
Indexable
#include<iostream>
using namespace std;

class calculation {
private:
    int arr[100];

public:
    void get_input(int n) {

    for(int i = 0;i<n;i++)
        cin>>arr[i];

    }

    void display(int pos) {
    cout<<"The Array Element is: "<<arr[pos]<<endl;

    }

};

int main() {
 calculation myarray;
 cout<<"Enter Array Size:"<<endl;
 int n,pos;
 cin>>n>>pos;
 myarray.get_input(n);
 myarray.display(pos);
}
Editor is loading...
Leave a Comment