CODE
#include<iostream>
using namespace std;
void merge(int arr1[],int arr2[],int len1,int len2)
{
int arr3[200];
int p=0;
int q=0;
int k=0;
while(p<len1 && q<len2)
{
if(arr1[p]<arr2[q])
{
arr3[k++]=arr1[p++];
}else{
arr3[k++]=arr2[q++];
}
}
while(p<len1)
{
arr3[k++]=arr1[p++];
}
while(q<len2)
{
arr3[k++]=arr2[q++];
}
for(int c=0;c<k;c++)
{
cout<<arr3[c]<<"";
}
}
int main()
{
int arr1[100],arr2[100],len1,len2;
cout<<"enter the length of first array: \n";
cin>>len1;
cout<<"enter the length of second array: \n";
cin>>len2;
cout<<"enter sorted values for first array:\n";
for(int i=0;i<len1;i++)
{
cin>>arr1[i];
}
cout<<"enter sorted values for first array:\n";
for(int j=0;j<len2;j++)
{
cin>>arr1[j];
}
merge(arr1,arr2,len1,len2);
return 0;
}
#include<iostream>
using namespace std;
void merge(int arr1[],int arr2[],int len1,int len2)
{
int arr3[200];
int p=0;
int q=0;
int k=0;
while(p<len1 && q<len2)
{
if(arr1[p]<arr2[q])
{
arr3[k++]=arr1[p++];
}else{
arr3[k++]=arr2[q++];
}
}
while(p<len1)
{
arr3[k++]=arr1[p++];
}
while(q<len2)
{
arr3[k++]=arr2[q++];
}
for(int c=0;c<k;c++)
{
cout<<arr3[c]<<"";
}
}
int main()
{
int arr1[100],arr2[100],len1,len2;
cout<<"enter the length of first array: \n";
cin>>len1;
cout<<"enter the length of second array: \n";
cin>>len2;
cout<<"enter sorted values for first array:\n";
for(int i=0;i<len1;i++)
{
cin>>arr1[i];
}
cout<<"enter sorted values for first array:\n";
for(int j=0;j<len2;j++)
{
cin>>arr1[j];
}
merge(arr1,arr2,len1,len2);
return 0;
}
Harrah's Cherokee Casino - Mapyro
ReplyDeleteCompare Harrah's Cherokee Casino reviews and find your way around the casino, finding 동두천 출장샵 the best 성남 출장마사지 deal and no 동해 출장마사지 deposit required! 전주 출장안마 Welcome Bonus up 충주 출장안마 to $1000!