#include ctr1=0; while(ctr1arr1[ctr2]) { 17 using namespace std; 18 19E int main() { int arr1[5]={30,20,50,10,40}; int n=5, ctr1, ctr2, temp; 20 21 22E 23 24E //display the original elements cout<<"Unsorted elements:"<arr1[ctr2]) { 32 } 33 //display the elements cout<
#include ctr1=0; while(ctr1arr1[ctr2]) { 17 using namespace std; 18 19E int main() { int arr1[5]={30,20,50,10,40}; int n=5, ctr1, ctr2, temp; 20 21 22E 23 24E //display the original elements cout<<"Unsorted elements:"<arr1[ctr2]) { 32 } 33 //display the elements cout<
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...
Related questions
Question
Implement the pseudocode of reading two dimensional array (ROW-WISE and COLUMN-WISE) into C++ program. Your program should ask for the size of the two-dim array and elements should be supplied externally by the user .
![1
#include <iostream>
ctr1=0;
while(ctr1<n-1)
{
ctr2=ctr1+1;
while(ctr2<n)
17
2
using namespace std;
18
3
19 E
int main()
5日{
4
20
21
int arr1[5]={30,20,50,10,40};
int n=5, ctr1, ctr2, temp;
22 E
7
if (arr1[ctr1]>arr1[ctr2])
{
temp=arr1[ctr1];
arr1[ctr1]=arr1[ctr2];
arri[ctr2]=temp;
}
ctr2++;
}
ctr1++;
23
8.
24E
//display the original elements
cout<<"Unsorted elements:"<<endl;
for (ctr1=0; ctr1<n; ctr1++)
{
cout<<arr1[ctr1]<<" ";
}
9
25
10
26
11
12E
13
14
15
27
28
29
30
31
//sorting starts here....
ctr1=0;
while(ctr1<n-1)
{
ctr2=ctr1+1;
while(ctr2<n)
{
if (arr1[ctr1]>arr1[ctr2])
16
32
17
18
19E
33
//display the elements
cout<<endl<<"Sorted elements:"<<endl;
for(ctr1=0; ctr1<n; ctr1++)
{
cout<<arr1[ctr1]<<" ";
}
return 0;
}
34
35
20
36
21
22E
23
24B
25
37E
38
39
40
temp=arr1[ctr1];
41](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F99068062-bd13-4e64-bc52-a7ab8e1ac2d8%2Ff9f6944d-a187-486e-b68f-3d66210142e4%2Fkpt34i_processed.png&w=3840&q=75)
Transcribed Image Text:1
#include <iostream>
ctr1=0;
while(ctr1<n-1)
{
ctr2=ctr1+1;
while(ctr2<n)
17
2
using namespace std;
18
3
19 E
int main()
5日{
4
20
21
int arr1[5]={30,20,50,10,40};
int n=5, ctr1, ctr2, temp;
22 E
7
if (arr1[ctr1]>arr1[ctr2])
{
temp=arr1[ctr1];
arr1[ctr1]=arr1[ctr2];
arri[ctr2]=temp;
}
ctr2++;
}
ctr1++;
23
8.
24E
//display the original elements
cout<<"Unsorted elements:"<<endl;
for (ctr1=0; ctr1<n; ctr1++)
{
cout<<arr1[ctr1]<<" ";
}
9
25
10
26
11
12E
13
14
15
27
28
29
30
31
//sorting starts here....
ctr1=0;
while(ctr1<n-1)
{
ctr2=ctr1+1;
while(ctr2<n)
{
if (arr1[ctr1]>arr1[ctr2])
16
32
17
18
19E
33
//display the elements
cout<<endl<<"Sorted elements:"<<endl;
for(ctr1=0; ctr1<n; ctr1++)
{
cout<<arr1[ctr1]<<" ";
}
return 0;
}
34
35
20
36
21
22E
23
24B
25
37E
38
39
40
temp=arr1[ctr1];
41
![#include <iostream>
using namespace std;
3
int main()
59 {
4
int arr1[2][3]={10,20,30,40,50,60};
int i=2, j=3, ctr1, ctr2;
7
//display elements in row-wise
ctr1=0;
while(ctr1<i)
9.
10
11
12E
ctr2=0;
while(ctr2<j)
{
cout<<arr1[ctr1][ctr2]<<" ";
ctr2++;
}
cout<<endl;
13
14
15 E
16
17
18
19
20
ctr1++;
21
}
22
23
return 0;
24
25 L }](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F99068062-bd13-4e64-bc52-a7ab8e1ac2d8%2Ff9f6944d-a187-486e-b68f-3d66210142e4%2Fdub1cz_processed.png&w=3840&q=75)
Transcribed Image Text:#include <iostream>
using namespace std;
3
int main()
59 {
4
int arr1[2][3]={10,20,30,40,50,60};
int i=2, j=3, ctr1, ctr2;
7
//display elements in row-wise
ctr1=0;
while(ctr1<i)
9.
10
11
12E
ctr2=0;
while(ctr2<j)
{
cout<<arr1[ctr1][ctr2]<<" ";
ctr2++;
}
cout<<endl;
13
14
15 E
16
17
18
19
20
ctr1++;
21
}
22
23
return 0;
24
25 L }
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
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](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY