Untitled
unknown
plain_text
a year ago
746 B
12
Indexable
#include<iostream> using namespace std; class arraymerge{ private: int arr1[30]; int arr2[30]; int arr3[60]; public: void get_input1(int m) { for (int i = 0;i<m;i++) { cin>>arr1[i]; arr3[i]=arr1[i];} } void get_input2(int m,int n) { for (int i = 0;i<n;i++){ cin>>arr2[i]; arr3[i+m]=arr2[i];} cout<<"Array after merged is:"<<endl; for(int i=0;i<m+n;i++) cout<<arr3[i]<<" "; } }; int main() { arraymerge myarray; cout<<"Enter the size of First Array:"; int m,n; cin>>m; myarray.get_input1(m); cout<<"Enter the size of Second Array:"; cin>>n; myarray.get_input2(m,n); return 0; }
Editor is loading...
Leave a Comment