Only Explain, How this C++ Program is working, Write brief Description. Just For Understanding Program Requirements Here's The Statement: Create 4 arrays of type integer having the size of 11 and...



Only Explain, How this C++ Program is working, Write brief Description.




Just For Understanding Program Requirements


Here's The Statement:




Create 4 arrays of type integer having the size of 11 and assign values to only 2 arrays using for loop.
• Once values are assigned to 2 arrays then you have to copy the values/element
from both arrays and assign/paste those values to the third and fourth array.
• After assigning values to the third and fourth array from the first and second array. Display
elements/values of array3 and array4.


• Array2 elements/values will be copied to array4.
In the end the array 3 and array4 will have the same elements/values as array1 and array2.



Briefly Explain only, how it's working.





Source code:


//main.cpp
#include
using namespace std;
int main()
{
 //set the N=11 as constant
 const int N=11;
 int array1[N];
 int array2[N];
 int array3[N];
 int array4[N];
 int index;


 cout<"**** first="" array=""><>
 //read array1 values
 for(index=0;index<>
 {
  cout<"enter element="" in="" array1="" at="" index="">
<><" =="" "="">
  cin>>array1[index];
 }
 cout<"****\nsecond array=""><>
 //read array2 values
 for(index=0;index<>
 {
  cout<"enter element="" in="" array2="" at="" index="">
<><" =="" "="">
  cin>>array2[index];
 }


 //copy array1 to array3
 for(index=0;index<>
 {
  array3[index]=array1[index];
 }
 //copy array2 to array4
 for(index=0;index<>
 {
  array4[index]=array2[index];
 }
 //display array3 values
 cout<"\ndisplaying elements="" of=""><>
 for(index=0;index<>
  cout<><">
 //display array4 values
 cout<"\ndisplaying elements="" of=""><>
 for(index=0;index<>
  cout<><">


 system("pause");
 return 0;
}



Output:



**** First Array ****<br>Enter element in arrayl at index 0<br>32<br>Enter element in arrayl at index 1<br>4<br>Enter element in arrayl at index 2<br>5<br>Enter element in arrayl at index 3<br>6<br>Enter element in arrayl at index 4<br>8<br>Enter element in arrayl at index 5<br>7<br>Enter element in arrayl at index 6<br>9<br>Enter element in arrayl at index 7<br>6<br>Enter element in arrayl at index 8<br>10<br>Enter element in arrayl at index 9<br>12<br>Enter element in arrayl at index 10<br>13<br>****<br>Second Array ****<br>Enter element in array2 at index 0<br>12<br>Enter element in array2 at index 1<br>14<br>Enter element in array2 at index 2<br>366<br>34<br>Enter element in array2 at index 3<br>Enter element in array2 at index 4<br>6<br>Enter element in array2 at index 5<br>Enter element in array2 at index 6<br>Enter element in array2 at index 7<br>Enter element in array2 at index 8<br>14<br>Enter element in array2 at index 9<br>15<br>Enter element in array2 at index 10<br>= 16<br>Displaying elements of array3<br>32 4 5 6 8 7 9 6 10 12 13<br>Displaying elements of array4<br>12 14 366 34 5 6 10 13 14 15 16 Press any key to continue .<br>034L<br>|| || || || || || || ||<br>|| || || || ||<br>|| || || ||<br>

Extracted text: **** First Array **** Enter element in arrayl at index 0 32 Enter element in arrayl at index 1 4 Enter element in arrayl at index 2 5 Enter element in arrayl at index 3 6 Enter element in arrayl at index 4 8 Enter element in arrayl at index 5 7 Enter element in arrayl at index 6 9 Enter element in arrayl at index 7 6 Enter element in arrayl at index 8 10 Enter element in arrayl at index 9 12 Enter element in arrayl at index 10 13 **** Second Array **** Enter element in array2 at index 0 12 Enter element in array2 at index 1 14 Enter element in array2 at index 2 366 34 Enter element in array2 at index 3 Enter element in array2 at index 4 6 Enter element in array2 at index 5 Enter element in array2 at index 6 Enter element in array2 at index 7 Enter element in array2 at index 8 14 Enter element in array2 at index 9 15 Enter element in array2 at index 10 = 16 Displaying elements of array3 32 4 5 6 8 7 9 6 10 12 13 Displaying elements of array4 12 14 366 34 5 6 10 13 14 15 16 Press any key to continue . 034L || || || || || || || || || || || || || || || || ||

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here