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 ****"<

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

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<iostream>
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 ****"<<endl;
 //read array1 values
 for(index=0;index<N;index++)
 {
  cout<<"Enter element in array1 at index "
   <<index<<" = " ;
  cin>>array1[index];
 }
 cout<<"****\nSecond Array ****"<<endl;
 //read array2 values
 for(index=0;index<N;index++)
 {
  cout<<"Enter element in array2 at index "
   <<index<<" = " ;
  cin>>array2[index];
 }

 //copy array1 to array3
 for(index=0;index<N;index++)
 {
  array3[index]=array1[index];
 }
 //copy array2 to array4
 for(index=0;index<N;index++)
 {
  array4[index]=array2[index];
 }
 //display array3 values
 cout<<"\nDisplaying elements of array3"<<endl;
 for(index=0;index<N;index++)
  cout<<array3[index]<<" ";
 //display array4 values
 cout<<"\nDisplaying elements of array4"<<endl;
 for(index=0;index<N;index++)
  cout<<array4[index]<<" ";

 system("pause");
 return 0;
}

Output:

 

**** 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
|| || || || || || || ||
|| || || || ||
|| || || ||
Transcribed Image 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 || || || || || || || || || || || || || || || || ||
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY