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]
4 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]4 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
The exception classes are in packages in the ________.
kakasveta [241]

Answer: Compiler

Explanation:

 The exception classes are basically occur during the compilation of the program in the system. The exception is the event which disrupt the flow of the instruction.

It basically provide a way to transfer the control in the one part of the program to another program. The exception class is also known as run-time exception that basically indicate the condition in the class application.

All the other options are not in the form of packages in the exception class. Therefore, compiler is the correct option.

8 0
4 years ago
Mark often gets headaches while working on his computer in the office. What activity can Mark do in the office to prevent headac
svet-max [94.6K]
Mark can prevent these headaches that he is getting on his computer by looking away from his monitor every now and again so he can rest his eyes.
4 0
4 years ago
Put the parts of the program in order to have the output shown below.
Ksenya-84 [330]
Diana is attaching a brace to a rectangular gate. She will put the brace on the diagonal of the rectangle as shown.
5 0
3 years ago
1 What do you understand by navigation through form?
Orlov [11]

Answer:

A navigation form is simply a form that contains a Navigation Control. Navigation forms are a great addition to any desktop database. Microsoft Access offers several features for controlling how users navigate the database.

7 0
3 years ago
How many components does a network have ?
Natasha2012 [34]

Answer:

There are three primary components to understanding networks: 1. Physical Connections; 2. Network Operating System; and 3. Application Component. Hope this helps!

Explanation:

4 0
3 years ago
Other questions:
  • A computer scientist creates a necklace to celebrate the birth of her daughter. The necklace encodes her daughter's
    6·1 answer
  • Which database item would show details such as a customer’s name, their last purchase, and other details about a customer
    14·2 answers
  • Trish has bought a new computer that she plans to start working on after a week. Since Trish has not used computers in the past,
    10·1 answer
  • Task:create a struct that looks like:typedef struct person{ int age; double height;} Person;Create an array of Persons. Read dat
    13·1 answer
  • What is one thing the ADDIE model does NOT account for?
    14·1 answer
  • Assume that PrecinctReport is a structured type with these fields, address (a string), and three int fields which are counts of
    9·1 answer
  • Integrity is keeping data consistent and free of errors or anomaliea<br> True or false
    7·1 answer
  • The Quick Access tool bar allows you to customize the actions or commands you frequently use.
    13·1 answer
  • Which 4 elements are commonly contained in a master page?
    11·1 answer
  • A ________ is a small, lightweight, power-conserving, computing device that is capable of wireless connectivity.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!