c++ practicals for class 12.odt

Download C++ Practicals for Class 12.odt

If you can't read please download the document

Upload: gaushini-ramuvel

Post on 05-Nov-2015

223 views

Category:

Documents


3 download

TRANSCRIPT

MRINMAY KUMAR DAS

PROGRAM 1PROGRAM STATEMENT:Write a program in C++ to perform the following operations on a two dimensional array using functionsMinimum and maximum element of mth row.

Minimum and maximum element of nthcolumn.

Diagonal elements

Swapping two rows.

Swapping two columns.

EXPECTED INPUT AND OUTPUT:INPUT-1. User gives which operation he wants to perform.2. User gives maximum rows and maximum columns and enters array.OUTPUT-1. Perform the operation and display the result.ALGORITHM:1. Take the array from the user and take max row and max col.2. Take the values associated with the operations.3. Perform the operation.4. For minimum and maximum element parse through the whole column, row and compare max and min element.5. For swapping 2 rows/columns, use a temporary variable.PROGRAM:#include#includevoid minmaxr(int a[10][10],int m,int q)//func to calculate min and max of a row{int j;int max=a[m-1][0];int min=a[m-1][0];for(j=0;jmax)max=a[m-1][j];if(a[m-1][j]