2D Array. The following program has a 2D array to store data. 1* row of the 2D array has 5 integers and 2nd row is the r

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

2D Array. The following program has a 2D array to store data. 1* row of the 2D array has 5 integers and 2nd row is the r

Post by answerhappygod »

2d Array The Following Program Has A 2d Array To Store Data 1 Row Of The 2d Array Has 5 Integers And 2nd Row Is The R 1
2d Array The Following Program Has A 2d Array To Store Data 1 Row Of The 2d Array Has 5 Integers And 2nd Row Is The R 1 (98.92 KiB) Viewed 34 times
2D Array. The following program has a 2D array to store data. 1* row of the 2D array has 5 integers and 2nd row is the reverse array of 1st row. Please fill your answer in the box to have the output as shown below. (10 points) Hint: Don't just assign { 5,4,3,2,1 } to 2nd row directly, or you will get 0 points. #include <iostream> using std::cout; using std::endl; #include <iomanip> using std::setw; sint main() { const int elements = 5; int numbers [2] (elements] = { {1, 2, 3, 4, 5},{0} }; cout << "\nOriginal array:" << endl; for (int i = 0; i < elements; i++) cout << setw(3) << numbers [@]; \\Mac\Home... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 - O х ? Original array: 1 2 3 4 5 The reversed array: 5 4 3 2 1 cout << "\n\nThe reversed array:" << endl; for (int i = 0; i < elements; i++) cout << setw(3) << numbers [1]; cout << endl << endl; system("pause"); return 0; }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply