SlideShare une entreprise Scribd logo
1  sur  1
Télécharger pour lire hors ligne
Important This programming assigument is for ALL the students, those who subscribed to
zyBooks and those who did not. It contains one problem. - Submit your source code on Moodle.
You must name your source file as follows: - For write your code in a file named a5submat.ce -
Use source file templatef.cc from the files provided on Moodle to start your program. - The
problem is marked out of 10 points. 2 Programming problem P1: A matrix is a two dimensional
vector (or a vector of vectors). See https://en.wikipedia.org/ wiki/Matrix_(mathenatics) for a
definition. A sub-matrix A of a matrix A is a matrix obtained by retaining elements of A that
belong to a subset of rows and columns of A. We consider the rows and columns of A identified
by their index. For example, suppose matrix A is a 45 matrix. The leftmost column of A is at
index 0 . The rightmost column of A is at index 4. The top row of A is at index 0 and the bottom
row of A is at. index 3. Then, the sub-matrix A obtained by selecting rows from 1 to 2 and
columns from 1 to 3 is given below.
AA=11010010002202002000330300300044040040005505005000=(202003030040400) Write a
program that reads a matrix of 'double' values with n rows and m columns from the input. The
first two values in the input are the positive integers n and m. Following are nm fractional values
for the entries of the matrix. The entries are listed in the input row by row. The last four values in
the input are the positive integers r,r+,c,c+, representing the smallest row index, the largest row
index, the smallest column index, and the largest column index of the sub-matrix, respectively.
For sub-matrix A above, r=1,r+=2,c=1,c+=3. Your program then outputs the sum of the entries
in the sub-matrix identified by integers r,r+,c,c+. You may assume that the values for r,r+,c,c+are
valid. Do not write any messages before reading your input. Design your output like in the
example below. Input:
Output: Input: Output:

Contenu connexe

Similaire à Important This programming assigument is for ALL the students, those .pdf

C UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYC UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDY
Rajeshkumar Reddy
 
Basics of matlab
Basics of matlabBasics of matlab
Basics of matlab
Anil Maurya
 
9781423902096_PPT_ch09.ppt
9781423902096_PPT_ch09.ppt9781423902096_PPT_ch09.ppt
9781423902096_PPT_ch09.ppt
LokeshK66
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
Dushmanta Nath
 
Practical java
Practical javaPractical java
Practical java
nirmit
 
matrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdfmatrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdf
ShafaqMehmood2
 

Similaire à Important This programming assigument is for ALL the students, those .pdf (20)

Arrays
ArraysArrays
Arrays
 
Write a function called float dotproduct (links to an external site.)(float a...
Write a function called float dotproduct (links to an external site.)(float a...Write a function called float dotproduct (links to an external site.)(float a...
Write a function called float dotproduct (links to an external site.)(float a...
 
Array sheet
Array sheet Array sheet
Array sheet
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
 
Digital communication lab lectures
Digital communication lab  lecturesDigital communication lab  lectures
Digital communication lab lectures
 
Project management
Project managementProject management
Project management
 
C UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDYC UNIT-3 PREPARED BY M V B REDDY
C UNIT-3 PREPARED BY M V B REDDY
 
1 linear algebra matrices
1 linear algebra matrices1 linear algebra matrices
1 linear algebra matrices
 
Basics of matlab
Basics of matlabBasics of matlab
Basics of matlab
 
9781423902096_PPT_ch09.ppt
9781423902096_PPT_ch09.ppt9781423902096_PPT_ch09.ppt
9781423902096_PPT_ch09.ppt
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
 
Practical java
Practical javaPractical java
Practical java
 
Matlab
MatlabMatlab
Matlab
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
matrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdfmatrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdf
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
 
C programming exercises and solutions
C programming exercises and solutions C programming exercises and solutions
C programming exercises and solutions
 
#1 designandanalysis of algo
#1 designandanalysis of algo#1 designandanalysis of algo
#1 designandanalysis of algo
 

Plus de watchamirpune

In 2022, Carson is claimed as a dependent on his parents tax return..pdf
 In 2022, Carson is claimed as a dependent on his parents tax return..pdf In 2022, Carson is claimed as a dependent on his parents tax return..pdf
In 2022, Carson is claimed as a dependent on his parents tax return..pdf
watchamirpune
 
In 1974, Loftus and Paimer conducted a classic study demonstrating ho.pdf
 In 1974, Loftus and Paimer conducted a classic study demonstrating ho.pdf In 1974, Loftus and Paimer conducted a classic study demonstrating ho.pdf
In 1974, Loftus and Paimer conducted a classic study demonstrating ho.pdf
watchamirpune
 

Plus de watchamirpune (20)

In a binomial situation, q=1p. True False.pdf
 In a binomial situation, q=1p. True False.pdf In a binomial situation, q=1p. True False.pdf
In a binomial situation, q=1p. True False.pdf
 
In 2025, the Robinson Company switched its inventory method from FIFO.pdf
 In 2025, the Robinson Company switched its inventory method from FIFO.pdf In 2025, the Robinson Company switched its inventory method from FIFO.pdf
In 2025, the Robinson Company switched its inventory method from FIFO.pdf
 
In 2022. Laureen is currently single. She paid $2,760 of qualified tu.pdf
 In 2022. Laureen is currently single. She paid $2,760 of qualified tu.pdf In 2022. Laureen is currently single. She paid $2,760 of qualified tu.pdf
In 2022. Laureen is currently single. She paid $2,760 of qualified tu.pdf
 
In 2022. Jasmine and Thomias, a married couple, had taxable income of.pdf
 In 2022. Jasmine and Thomias, a married couple, had taxable income of.pdf In 2022. Jasmine and Thomias, a married couple, had taxable income of.pdf
In 2022. Jasmine and Thomias, a married couple, had taxable income of.pdf
 
In 2022, Jasmine and Thomas, a married couple, had taxable income.pdf
 In 2022, Jasmine and Thomas, a married couple, had taxable income.pdf In 2022, Jasmine and Thomas, a married couple, had taxable income.pdf
In 2022, Jasmine and Thomas, a married couple, had taxable income.pdf
 
In 2022, Carson is claimed as a dependent on his parents tax return..pdf
 In 2022, Carson is claimed as a dependent on his parents tax return..pdf In 2022, Carson is claimed as a dependent on his parents tax return..pdf
In 2022, Carson is claimed as a dependent on his parents tax return..pdf
 
Implement the recursive function CountNodes of a binary tree. struc.pdf
 Implement the recursive function CountNodes of a binary tree. struc.pdf Implement the recursive function CountNodes of a binary tree. struc.pdf
Implement the recursive function CountNodes of a binary tree. struc.pdf
 
In 1974, Loftus and Paimer conducted a classic study demonstrating ho.pdf
 In 1974, Loftus and Paimer conducted a classic study demonstrating ho.pdf In 1974, Loftus and Paimer conducted a classic study demonstrating ho.pdf
In 1974, Loftus and Paimer conducted a classic study demonstrating ho.pdf
 
In Arabidopsis, you look at three closely linked traits on chromosome.pdf
 In Arabidopsis, you look at three closely linked traits on chromosome.pdf In Arabidopsis, you look at three closely linked traits on chromosome.pdf
In Arabidopsis, you look at three closely linked traits on chromosome.pdf
 
Imagine that investors expect to receive a compensation of rE=10 for.pdf
 Imagine that investors expect to receive a compensation of rE=10 for.pdf Imagine that investors expect to receive a compensation of rE=10 for.pdf
Imagine that investors expect to receive a compensation of rE=10 for.pdf
 
Image A is best described as A plant cell during prophase An animal.pdf
 Image A is best described as A plant cell during prophase An animal.pdf Image A is best described as A plant cell during prophase An animal.pdf
Image A is best described as A plant cell during prophase An animal.pdf
 
In 1930, the U.S. government attempted to help domestic firms that we.pdf
 In 1930, the U.S. government attempted to help domestic firms that we.pdf In 1930, the U.S. government attempted to help domestic firms that we.pdf
In 1930, the U.S. government attempted to help domestic firms that we.pdf
 
In April 2021, the University Sub Shop had an average check of $7.25 .pdf
 In April 2021, the University Sub Shop had an average check of $7.25 .pdf In April 2021, the University Sub Shop had an average check of $7.25 .pdf
In April 2021, the University Sub Shop had an average check of $7.25 .pdf
 
In 2003 and 2017 a poll asked Democratic voters about their views on .pdf
 In 2003 and 2017 a poll asked Democratic voters about their views on .pdf In 2003 and 2017 a poll asked Democratic voters about their views on .pdf
In 2003 and 2017 a poll asked Democratic voters about their views on .pdf
 
In C++, the function is called at program startup. group start root m.pdf
 In C++, the function is called at program startup. group start root m.pdf In C++, the function is called at program startup. group start root m.pdf
In C++, the function is called at program startup. group start root m.pdf
 
In 199746 of Americans said they did not trust the media when it co.pdf
 In 199746 of Americans said they did not trust the media when it co.pdf In 199746 of Americans said they did not trust the media when it co.pdf
In 199746 of Americans said they did not trust the media when it co.pdf
 
In Canada the proportion of the population is insolvent is 0.3. You.pdf
 In Canada the proportion of the population is insolvent is 0.3. You.pdf In Canada the proportion of the population is insolvent is 0.3. You.pdf
In Canada the proportion of the population is insolvent is 0.3. You.pdf
 
In Australia grassland, the summer time has minimum rainfall no rainf.pdf
 In Australia grassland, the summer time has minimum rainfall no rainf.pdf In Australia grassland, the summer time has minimum rainfall no rainf.pdf
In Australia grassland, the summer time has minimum rainfall no rainf.pdf
 
In an effort to determine the immunoglobulin D (IgD) levels of a cert.pdf
 In an effort to determine the immunoglobulin D (IgD) levels of a cert.pdf In an effort to determine the immunoglobulin D (IgD) levels of a cert.pdf
In an effort to determine the immunoglobulin D (IgD) levels of a cert.pdf
 
In addition, $2,476 was collected for Sandhill Company in August by t.pdf
 In addition, $2,476 was collected for Sandhill Company in August by t.pdf In addition, $2,476 was collected for Sandhill Company in August by t.pdf
In addition, $2,476 was collected for Sandhill Company in August by t.pdf
 

Dernier

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Dernier (20)

General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 

Important This programming assigument is for ALL the students, those .pdf

  • 1. Important This programming assigument is for ALL the students, those who subscribed to zyBooks and those who did not. It contains one problem. - Submit your source code on Moodle. You must name your source file as follows: - For write your code in a file named a5submat.ce - Use source file templatef.cc from the files provided on Moodle to start your program. - The problem is marked out of 10 points. 2 Programming problem P1: A matrix is a two dimensional vector (or a vector of vectors). See https://en.wikipedia.org/ wiki/Matrix_(mathenatics) for a definition. A sub-matrix A of a matrix A is a matrix obtained by retaining elements of A that belong to a subset of rows and columns of A. We consider the rows and columns of A identified by their index. For example, suppose matrix A is a 45 matrix. The leftmost column of A is at index 0 . The rightmost column of A is at index 4. The top row of A is at index 0 and the bottom row of A is at. index 3. Then, the sub-matrix A obtained by selecting rows from 1 to 2 and columns from 1 to 3 is given below. AA=11010010002202002000330300300044040040005505005000=(202003030040400) Write a program that reads a matrix of 'double' values with n rows and m columns from the input. The first two values in the input are the positive integers n and m. Following are nm fractional values for the entries of the matrix. The entries are listed in the input row by row. The last four values in the input are the positive integers r,r+,c,c+, representing the smallest row index, the largest row index, the smallest column index, and the largest column index of the sub-matrix, respectively. For sub-matrix A above, r=1,r+=2,c=1,c+=3. Your program then outputs the sum of the entries in the sub-matrix identified by integers r,r+,c,c+. You may assume that the values for r,r+,c,c+are valid. Do not write any messages before reading your input. Design your output like in the example below. Input: Output: Input: Output: