1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
salantis [7]
3 years ago
11

Question 4(10pt): sum of the max value found in each row Write a function maxSum that takes two parameters; a 2D integer array w

ith 10 columns, and the number of rows. The function must return the sum of the maximum value from each row.
Computers and Technology
1 answer:
mario62 [17]3 years ago
5 0

Answer:

Following is the program in c++ language  

#include <iostream> // header file

using namespace std; // namespace

int maxSum(int ar[][10],int r) // function definition of  maxsum

{

  int s=0; // varaible declaration

  for(int k=0;k<r;k++)// iterating the loop

  {

      int maximum=ar[k][0]; //finding the maximum value

      for(int k2=0;k2<10;k2++)// iterating the loop

      {

          if(maximum<ar[k][k2]) // check the condition

          {

            maximum=ar[k][k2];   // storing the value in the maximum variable

          }

           }

       s=s+maximum;//adding maximum value to the sum

  }

  return s; // return the sum

}

int main() // main function

{

  int ar[][10]={{5,2,8,-8,9,9,8,-5,-1,-5},{4,1,8,0,10,7,6,1,8,-5}}; // initilaized array

  cout<<"sum of maximum value:";

  int t=maxSum(ar,2); // function calling

  cout<<t; // display the maximum value

}

Output:

sum of maximum value:19

Explanation:

Following are the description of Program  

  • The main method declared and initialized an array ar with the column value 10.
  • After that call the method maxsum .The control will move to the function definition of maxsum.
  • In the function header of maxisum there are two value i.e array "ar" and "r".
  • In this function definition, we adding the maximum value to the sum and return the variable "s".
  • In the main function, we print the value.
You might be interested in
You notice that lately your computer has been running slow. When you open up your web browser, you get endless pop-up ads to the
Vlad [161]

Answer:

Spyware

Explanation:

The reason why you noticed your computer has been running slow is because of spyware, which is considered to be very bad to get on your computer. When a user opens his/her web browser, the user receives ads that are misleading to the user, which fools the user of thinking it's something real and not a scam. Not only that, the user also receives pop-up ads that can, as mentioned, trick the user to think that it's real and not fake. Finally, the user's search results will be manipulated. In conclusion, spyware is, in fact, the main cause of the scenario.

4 0
2 years ago
Based on the screenshot below which letter do you select to sort the items in an alphabetical order?
gladu [14]

Answer:

the smallest number start with the first number of the alphabet

6 0
3 years ago
Which of the following is a template definition?
musickatia [10]

Answer:

b. template<classT>.

Explanation:

Template functions are that can work with generic types. Template lets us to create a function so that more than 1 type or class can adapt  the functionality of that function.

We can write the template function as following:-

template<class typename>.

It matches to the option b.

5 0
2 years ago
An if statement must always begin with the word “if.” True False python
MrMuchimi

Answer:

true

Explanation:

6 0
2 years ago
Read 2 more answers
I want to build a video player on the html5 canvas here is my code
jok3333 [9.3K]

Answer:

hospital yestrday after noon ggpupg ki tyutrdcbhsjdvshsjjshsgsgdhsusfsuwwiiwhszia

8 0
1 year ago
Other questions:
  • In this story, the reader is strongly encouraged to believe that Skidmore is guilty of poisoning his brother Manchester. Explain
    6·1 answer
  • Given a computer running four types of instuctions, named classes A through D, calculate the execution time of a program that ha
    5·1 answer
  • Help please brainliest
    8·1 answer
  • Within a google form when looking which option do u use?
    13·1 answer
  • Mercury Technical Solutions has been using SSL in a business-to-business environment for a number of years. Despite the fact tha
    5·1 answer
  • Which one is a run-on sentence? you get mark the brilist
    5·2 answers
  • Which evaluation factor will be most important when choosing technology for the company
    5·1 answer
  • Find the mistakes in the following code. Not all lines contain mistakes. Each line depends on the lines preceding it. Watch out
    14·1 answer
  • Why use LinkedIn automation for LinkedIn?
    10·1 answer
  • Write an alogorithm and draw the Flow Chart to
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!