CODE USING C++ When dealing with problems, it is always best to find the "elephant" in the room. The elephant is basically the biggest issue. Once this is resolved, it's almost always easier to move forward.   As a therapist, I know how to find the elephant in the room. However, I'm feeling sick today and the next client is coming. Could you please find the elephant for me? Instructions: In the code editor, you are provided with a function, findElephant() that accepts a 2D array and returns the largest element in the array. This function has already been implemented so do not edit this. You are also provided with the 2D array in the main() function. Your only task is to call the findElephant() function and pass the 2D array, and print the return value. Output Elephant:·10

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

CODE USING C++

When dealing with problems, it is always best to find the "elephant" in the room. The elephant is basically the biggest issue.

Once this is resolved, it's almost always easier to move forward.

 

As a therapist, I know how to find the elephant in the room. However, I'm feeling sick today and the next client is coming. Could you please find the elephant for me?

Instructions:

  1. In the code editor, you are provided with a function, findElephant() that accepts a 2D array and returns the largest element in the array. This function has already been implemented so do not edit this.
  2. You are also provided with the 2D array in the main() function.
  3. Your only task is to call the findElephant() function and pass the 2D array, and print the return value.

Output

Elephant:·10
 
main.cpp
4. Find the Elephant
by CodeChum Admin
1 #include <iostream>
2 #include <climits>
When dealing with problems, it is always best to find the
3 using namespace std;
4
"elephant" in the room. The elephant is basically the
5 int findElephant (int[][100]);
biggest issue.
7 int main(void) {
Once this is resolved, it's almost always easier to move
int matrix[100][100]
{1, 3, 33, 109, 2, 65, 32, 28, 129, 75},
{2, 44, 59, 8, 231, 632, 55, 205, 98, 1},
{76, 2, 321, 16, 209, 65, 12, 167, 259, 29},
{0, 103, 99, 3, 2, 65, 32, 321, 53, 75},
{44, 264, 50, 7, 142, 65, 100, 28, 98, 33},
{87, 22, 99, 67, 22, 412, 99, 502, 52, 24},
{91, 93, 233, 101, 330, 65, 98, 28, 98, 76},
{12, 65, 59, 99, 2, 65, 32, 333, 10, 88},
{3, 24, 101, 331, 542, 65, 32, 239, 338, 175},
{76, 3, 59, 21, 229, 65, 32, 28, 98, 75},
};
8
{
forward.
10
As a therapist, I know how to find the elephant in the
11
12
room. However, I'm feeling sick today and the next client
13
is coming. Could you please find the elephant for me?
14
15
Instructions:
16
17
1. In the code editor, you are provided with a function,
18
findElephant() that accepts a 2D array and
19
returns the largest element in the array. This
20
function has already been implemented so do not
21
edit this.
22
return 0;
2. You are also provided with the 2D array in the
23 }
24
main() function.
3. Your only task is to call the findElephant ()
25 // NOTE: DO NOT EDIT THIS FUNCTION
26 int findElephant (int arr[][100]) {
int largest = INT_MIN;
function and pass the 2D array, and print the return
27
value.
28
for(int row = 0; row < 100; row++) {
for (int col = 0; col < 100; col++) {
if(arr[row][col] > largest) {
29
30
Output
31
32
largest = arr[row][col];
}
}
}
33
34
Elephant: 10
35
36
37
return largest;
38 }
Transcribed Image Text:main.cpp 4. Find the Elephant by CodeChum Admin 1 #include <iostream> 2 #include <climits> When dealing with problems, it is always best to find the 3 using namespace std; 4 "elephant" in the room. The elephant is basically the 5 int findElephant (int[][100]); biggest issue. 7 int main(void) { Once this is resolved, it's almost always easier to move int matrix[100][100] {1, 3, 33, 109, 2, 65, 32, 28, 129, 75}, {2, 44, 59, 8, 231, 632, 55, 205, 98, 1}, {76, 2, 321, 16, 209, 65, 12, 167, 259, 29}, {0, 103, 99, 3, 2, 65, 32, 321, 53, 75}, {44, 264, 50, 7, 142, 65, 100, 28, 98, 33}, {87, 22, 99, 67, 22, 412, 99, 502, 52, 24}, {91, 93, 233, 101, 330, 65, 98, 28, 98, 76}, {12, 65, 59, 99, 2, 65, 32, 333, 10, 88}, {3, 24, 101, 331, 542, 65, 32, 239, 338, 175}, {76, 3, 59, 21, 229, 65, 32, 28, 98, 75}, }; 8 { forward. 10 As a therapist, I know how to find the elephant in the 11 12 room. However, I'm feeling sick today and the next client 13 is coming. Could you please find the elephant for me? 14 15 Instructions: 16 17 1. In the code editor, you are provided with a function, 18 findElephant() that accepts a 2D array and 19 returns the largest element in the array. This 20 function has already been implemented so do not 21 edit this. 22 return 0; 2. You are also provided with the 2D array in the 23 } 24 main() function. 3. Your only task is to call the findElephant () 25 // NOTE: DO NOT EDIT THIS FUNCTION 26 int findElephant (int arr[][100]) { int largest = INT_MIN; function and pass the 2D array, and print the return 27 value. 28 for(int row = 0; row < 100; row++) { for (int col = 0; col < 100; col++) { if(arr[row][col] > largest) { 29 30 Output 31 32 largest = arr[row][col]; } } } 33 34 Elephant: 10 35 36 37 return largest; 38 }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education