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
I need someone to explain gor me python coding!
forsale [732]

Answer:

Explanation:

Python is a computer programming language often used to build websites and software, automate tasks, and conduct data analysis. Python is a general purpose language, meaning it can be used to create variety of different programs and isn't specialised for any specific problems

8 0
3 years ago
⦁ ¿Cuáles son los recursos naturales que se utilizan en tu comunidad para generar energía eléctrica?
xxTIMURxx [149]
Turbinas de viento y turbinas de agua son utilizadas, entonces la respuesta podria ser viento y agua
7 0
3 years ago
How can you resize the program window?​
Daniel [21]

Answer:

Resize a window by dragging the edges or corner of the window. Hold down Shift while resizing to snap the window to the edges of the screen and other windows. Move or resize a window using only the keyboard. Press Alt + F7 to move a window or Alt + F8 to resize.

4 0
3 years ago
Read 2 more answers
Whats in a computer?
kenny6666 [7]
A lot of things are in a computer there a motherboard, A cpu, A hard drive etc. A motherboard is the computer system  bascilly its the heart for a computer. The cpu is the the brain of a computer it controls on your computer and keeps it going good. finally a hard rive is the memory of your computer it stores all the data including files, photos, etc
8 0
3 years ago
Read 2 more answers
The Horse table has the following columns:
dimulka [17.4K]

See below for the statement to insert the data values

<h3>How to insert the records?</h3>

To do this, we make use of the insert statement.

This is done using the following syntax:

INSERT INTO table_name (column_name, ...) VALUES (value, ...)

Using the above syntax and the data values, we have the following insert statement.

INSERT INTO Horse (RegisteredName, Breed, Height, BirthDate)

VALUES ('Babe Quarter', 'Horse', '15.3', '2015-02-10'), ('Independence', 'Holsteiner', '16.0', '2017-03-13'), ('Ellie', 'Saddlebred', '15.0', '2016-12-22')

INSERT INTO Horse (Breed, Height, BirthDate) VALUES ('Egyptian Arab', '14.9','2019-10-12')

Read more about SQL at:

brainly.com/question/10097523

#SPJ1

4 0
2 years ago
Other questions:
  • 13. What is the suggested rpm on a hard drive for a laptop?
    12·1 answer
  • What is the advantage of using a subject directory like the public internet library ?
    11·1 answer
  • Please check my answer! (Java)
    8·1 answer
  • Which of the following is not a data type in python Float, string, integer, decimal ​
    15·2 answers
  • You have just starting working at Quantum Company. As a new programmer, you have been asked to review and correct various pseudo
    14·1 answer
  • Which of the following statements about federal student loans is true?
    7·1 answer
  • WILL GIVE BRAINLIEST
    15·1 answer
  • What game is the best for racing and modifying cars
    10·1 answer
  • 1. Haruto was a programmer working in the early 2000s. Which kind of program or language was
    5·1 answer
  • how is a two-dimensional array different from a traditional one dimensional array? From an ArrayList?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!