SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Downloaden Sie, um offline zu lesen
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:

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

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
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
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
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.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)
 
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
 
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...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
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.
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
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...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 

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: