classes and objects for lab

 #include <iostream>

using namespace std;

class average

{

    public:

    int a,b,c,d,e;

    void getdata()

    {

    cout<<"Enter the 5 elements";

    cout<<"\n";

    cin>>a;

    cout<<"\n";

    cin>>b;

    cout<<"\n";

    cin>>c;

    cout<<"\n";

    cin>>d;

    cout<<"\n";

    cin>>e;

    }

    void putdata()

    {

        cout<<"the average is"<<a+b+c+d+e/5;

    }

};

int main()

{

average obj;

obj.getdata();

obj.putdata();

return 0;

}


Comments

Popular posts from this blog

LIST ADT USING LINKED LIST

CLASSES CREATION

SORTING PROGRAM