SlideShare ist ein Scribd-Unternehmen logo
1 von 2
Downloaden Sie, um offline zu lesen
ARRAY - TWO DIMENSION 
1 www.cppforschool.com 
[SET – 1] 
Question 1 Write a menu driven C++ program to do following operation on two dimensional 
array A of size m x n. You should use user-defined functions which accept 2-D 
array A, and its size m and n as arguments. The options are: 
· To input elements into matrix of size m x n 
· To display elements of matrix of size m x n 
· Sum of all elements of matrix of size m x n 
· To display row-wise sum of matrix of size m x n 
· To display column-wise sum of matrix of size m x n 
· To create transpose of matrix B of size n x m 
Question 2 Write user defined functions for square matrix to calculate 
· Left diagonal sum 
· Right diagonal sum 
Question 3 Write a user-defined function in C++ to display the multiplication of row element 
of two-dimensional array A[4][6] containing integer. 
Question 4 Write a user defined function named Upper-half() which takes a two dimensional 
array A, with size N rows and N columns as argument and prints the upper half of 
the array. 
e.g., 
2 3 1 5 0 2 3 1 5 0 
7 1 5 3 1 1 5 3 1 
2 5 7 8 1 The output will be 1 7 8 
0 1 5 0 1 0 1 
3 4 9 1 5 5 
Question 5 Write a function in C++ which accepts a 2D array of integers and its size as 
arguments and displays the elements of middle row and the elements of middle 
column. 
[Assuming the 2D Array to be a square matrix with odd dimension i.e. 3x3, 5x5, 
7x7 etc...] 
Example, if the array contents is
3 5 4 
7 6 9 
2 1 8 
Output through the function should be : 
Middle Row : 7 6 9 
Middle column : 5 6 1 
Question 6 Write a program to add two array A and B of size m x n. 
Question 7 Write a program to multiply array A and B of order NxL and LxM 
2 www.cppforschool.com

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (18)

CS291(C Programming) assignment
CS291(C Programming) assignmentCS291(C Programming) assignment
CS291(C Programming) assignment
 
Programming qns
Programming qnsProgramming qns
Programming qns
 
Core 3 Functions 3
Core 3 Functions 3Core 3 Functions 3
Core 3 Functions 3
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Matrix operations in MATLAB
Matrix operations in MATLABMatrix operations in MATLAB
Matrix operations in MATLAB
 
Matlab Files
Matlab FilesMatlab Files
Matlab Files
 
Matlab graphics
Matlab graphicsMatlab graphics
Matlab graphics
 
9.2 notes
9.2 notes9.2 notes
9.2 notes
 
Core 3 Functions 2
Core 3 Functions 2Core 3 Functions 2
Core 3 Functions 2
 
R Programming: Introduction to Matrices
R Programming: Introduction to MatricesR Programming: Introduction to Matrices
R Programming: Introduction to Matrices
 
Epc assignment
Epc assignmentEpc assignment
Epc assignment
 
Matrices, Arrays and Vectors in MATLAB
Matrices, Arrays and Vectors in MATLABMatrices, Arrays and Vectors in MATLAB
Matrices, Arrays and Vectors in MATLAB
 
c++ Question
c++  Questionc++  Question
c++ Question
 
Ppt 2 d ploting k10998
Ppt 2 d ploting k10998Ppt 2 d ploting k10998
Ppt 2 d ploting k10998
 
Activities on Software Development
Activities on Software DevelopmentActivities on Software Development
Activities on Software Development
 
Exp 1
Exp 1Exp 1
Exp 1
 
Matrices
MatricesMatrices
Matrices
 
Onto Functions
Onto FunctionsOnto Functions
Onto Functions
 

Andere mochten auch

Andere mochten auch (14)

Lo48
Lo48Lo48
Lo48
 
Chapter 7 - Input Output Statements in C++
Chapter 7 - Input Output Statements in C++Chapter 7 - Input Output Statements in C++
Chapter 7 - Input Output Statements in C++
 
intro to pointer C++
intro to  pointer C++intro to  pointer C++
intro to pointer C++
 
C++ Interview Questions
C++ Interview QuestionsC++ Interview Questions
C++ Interview Questions
 
Templates exception handling
Templates exception handlingTemplates exception handling
Templates exception handling
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
C++ functions
C++ functionsC++ functions
C++ functions
 
C++ interview question
C++ interview questionC++ interview question
C++ interview question
 
Ponters
PontersPonters
Ponters
 
C++ questions and answers
C++ questions and answersC++ questions and answers
C++ questions and answers
 
07 Input Output
07  Input  Output07  Input  Output
07 Input Output
 
Pointers
PointersPointers
Pointers
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
 
Unit 6 pointers
Unit 6   pointersUnit 6   pointers
Unit 6 pointers
 

Ähnlich wie A02

An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersMurshida ck
 
Travaux Pratique Matlab + Corrige_Smee Kaem Chann
Travaux Pratique Matlab + Corrige_Smee Kaem ChannTravaux Pratique Matlab + Corrige_Smee Kaem Chann
Travaux Pratique Matlab + Corrige_Smee Kaem ChannSmee Kaem Chann
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical ComputingNaveed Rehman
 
Data Structure & Algorithms - Matrix Multiplication
Data Structure & Algorithms - Matrix MultiplicationData Structure & Algorithms - Matrix Multiplication
Data Structure & Algorithms - Matrix Multiplicationbabuk110
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptximman gwu
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabBilawalBaloch1
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfUmarMustafa13
 
Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxPremanandS3
 
Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4Randa Elanwar
 
Matlab practice
Matlab practiceMatlab practice
Matlab practiceZunAib Ali
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functionsjoellivz
 
Exposure Interval Initial Risk Assessment (with exist.docx
Exposure Interval    Initial Risk Assessment (with exist.docxExposure Interval    Initial Risk Assessment (with exist.docx
Exposure Interval Initial Risk Assessment (with exist.docxssuser454af01
 
Practical java
Practical javaPractical java
Practical javanirmit
 

Ähnlich wie A02 (20)

Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 
Travaux Pratique Matlab + Corrige_Smee Kaem Chann
Travaux Pratique Matlab + Corrige_Smee Kaem ChannTravaux Pratique Matlab + Corrige_Smee Kaem Chann
Travaux Pratique Matlab + Corrige_Smee Kaem Chann
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
Data Structure & Algorithms - Matrix Multiplication
Data Structure & Algorithms - Matrix MultiplicationData Structure & Algorithms - Matrix Multiplication
Data Structure & Algorithms - Matrix Multiplication
 
Mechanical Engineering Homework Help
Mechanical Engineering Homework HelpMechanical Engineering Homework Help
Mechanical Engineering Homework Help
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
CE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdfCE344L-200365-Lab2.pdf
CE344L-200365-Lab2.pdf
 
Programming Exam Help
 Programming Exam Help Programming Exam Help
Programming Exam Help
 
Matlab booklet
Matlab bookletMatlab booklet
Matlab booklet
 
Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
 
Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4Introduction to matlab lecture 2 of 4
Introduction to matlab lecture 2 of 4
 
Matlab practice
Matlab practiceMatlab practice
Matlab practice
 
Introduction to Matlab - Basic Functions
Introduction to Matlab - Basic FunctionsIntroduction to Matlab - Basic Functions
Introduction to Matlab - Basic Functions
 
Exposure Interval Initial Risk Assessment (with exist.docx
Exposure Interval    Initial Risk Assessment (with exist.docxExposure Interval    Initial Risk Assessment (with exist.docx
Exposure Interval Initial Risk Assessment (with exist.docx
 
Exercise1 java
Exercise1 javaExercise1 java
Exercise1 java
 
Mmt 001
Mmt 001Mmt 001
Mmt 001
 
Practical java
Practical javaPractical java
Practical java
 

Mehr von lksoo

Mehr von lksoo (20)

Lo43
Lo43Lo43
Lo43
 
Lo39
Lo39Lo39
Lo39
 
Lo37
Lo37Lo37
Lo37
 
Lo27
Lo27Lo27
Lo27
 
Lo17
Lo17Lo17
Lo17
 
Lo12
Lo12Lo12
Lo12
 
T3
T3T3
T3
 
T2
T2T2
T2
 
T1
T1T1
T1
 
T4
T4T4
T4
 
P5
P5P5
P5
 
P4
P4P4
P4
 
P3
P3P3
P3
 
P1
P1P1
P1
 
P2
P2P2
P2
 
L10
L10L10
L10
 
L9
L9L9
L9
 
L8
L8L8
L8
 
L7
L7L7
L7
 
L6
L6L6
L6
 

Kürzlich hochgeladen

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 

Kürzlich hochgeladen (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

A02

  • 1. ARRAY - TWO DIMENSION 1 www.cppforschool.com [SET – 1] Question 1 Write a menu driven C++ program to do following operation on two dimensional array A of size m x n. You should use user-defined functions which accept 2-D array A, and its size m and n as arguments. The options are: · To input elements into matrix of size m x n · To display elements of matrix of size m x n · Sum of all elements of matrix of size m x n · To display row-wise sum of matrix of size m x n · To display column-wise sum of matrix of size m x n · To create transpose of matrix B of size n x m Question 2 Write user defined functions for square matrix to calculate · Left diagonal sum · Right diagonal sum Question 3 Write a user-defined function in C++ to display the multiplication of row element of two-dimensional array A[4][6] containing integer. Question 4 Write a user defined function named Upper-half() which takes a two dimensional array A, with size N rows and N columns as argument and prints the upper half of the array. e.g., 2 3 1 5 0 2 3 1 5 0 7 1 5 3 1 1 5 3 1 2 5 7 8 1 The output will be 1 7 8 0 1 5 0 1 0 1 3 4 9 1 5 5 Question 5 Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements of middle row and the elements of middle column. [Assuming the 2D Array to be a square matrix with odd dimension i.e. 3x3, 5x5, 7x7 etc...] Example, if the array contents is
  • 2. 3 5 4 7 6 9 2 1 8 Output through the function should be : Middle Row : 7 6 9 Middle column : 5 6 1 Question 6 Write a program to add two array A and B of size m x n. Question 7 Write a program to multiply array A and B of order NxL and LxM 2 www.cppforschool.com