Created
May 19, 2017 11:55
-
-
Save m-ahmedy/c0b3921523f838007c929cee9f96e853 to your computer and use it in GitHub Desktop.
Concatenate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
const int size1=5 , size2=6 , newSize=size1+size2; | |
int arr1[size1], arr2[size2] , newArr[newSize]; | |
cout<<"Enter arr1 data: "<<endl; | |
for(int i=0 ; i<size1 ; i++){ | |
cout<<"Enter data #"<<i+1<<" : "; | |
cin>>arr1[i]; | |
} | |
cout<<"Enter arr2 data: "<<endl; | |
for(int i=0 ; i<size2 ; i++){ | |
cout<<"Enter data #"<<i+1<<" : "; | |
cin>>arr2[i]; | |
} | |
for(int i=0 ; i<size1 ; i++) | |
newArr[i]=arr1[i]; | |
for(int j=size1 ; j<newSize ; j++) | |
newArr[j]=arr2[j-size1]; | |
cout<<"newArr data: "<<endl; | |
for(int k=0 ; k<newSize ; k++)cout<<"Data #"<<k+1<<" : "<<newArr[k]<<endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment