OOCP4-2

//BCA Support //www.bcasupport.xyz #include <iostream.h> #include <conio.h> template <class t> class array { t array[10]; public: void input() { int i=0; cout<<"\nEnter 10 numbers :\n"; while(i<10) cin>>array[i++]; } void output() { int i=0; cout<<"\nArray-\n"; while(i<10) cout<<array[i++]<<endl; } }; int main() { clrscr(); int ch; array <int>obj;//change <datatype> to create array of that type obj.input(); //for eg. array <float>obj will create array of float type obj.output(); getch(); return 0; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.