#include<iostream>
#include<conio.h>
using namespace std;
//declaration of variables
const int MaxRows=3;//variable for max num of arrays, will be used for input
const int MaxCols=3;//variable for max num of cols
void readMatrix(int arr[][MaxCols]);// PROTOTYPE FOR FUNCTION AT LINE 32
void displayMatrix(int a[][MaxCols]);//PROTOTYPE FOR FUNCTION AT LINE 44
void displayFlippedMatrix(int a [][MaxCols]);//PROTOTYPE FOR MATRIX AT LINE 22
int main()// the book says *****void main(void )******** but it gives compiler error
// HOO HAAA i have no idea as the faculty member can not make a mistake, there is some thing wrong
// either with me or the compiler that is in this SW package, go trucking as long as works.
{// this comment is by me so has very less importance
//_______________ not a part of the program just programming delima___________________________________________________________________________
cout<<"\nIt is a complex program and needs to be understood completely\n";
cout<<"Please go to the comments and draw conclusion Add coments and return this code Thanks2";
//______________not a part of the program_____________________________________
int a[MaxRows][MaxCols];// this is an array of intigertype and the name is a.
// has been used here in readMatrix
readMatrix(a);// function call to the function below voidReadmatrix at line31
cout << "\n\n" << "The original matrix is: " << '\n';
displayMatrix(a);// this is a function call of display which is a function on line 49
// but needs to be explained why has it been used and what is technical in it
// Display the flipped matrix
cout << "\n\n" << "The flipped matrix is: " << '\n';// an output command which will activate the function
// may be it should or should not betermed as function call
displayFlippedMatrix(a);//unction call to the function at line 55 HOOO HAAA coment may be invalid
//so a beter comment will fill in the space in this xyz plane that Me unterstands least .
}
//****************THIS IS A FUNCTION WHICH RETURNS NO VALUE*********************************
//_______________________________input function________________________________________________________________________
void readMatrix(int arr[][MaxCols])// ON CALL HOO HAA it reads the matrix and passes on to main hoo haaa
{//what is this loop for*****_____
int row, col;
for (row = 0; row < MaxRows; row ++)
{
for(col=0; col < MaxCols; col ++)
{// oh it gives a prompt to user to fill in the value
cout << "\n" << "Enter " << row << ", " << col << " element: ";
// then creates a place where the value can be filled in it is an input function for
//user input
cin >> arr[row][col];
//-------------------------END of Input Function-------------------------------------------------------------------------------------
}
cout << '\n';// escape character on test it was found that it segrigated the
// set of rows to difreciate betveen the sets on commenting it out all the data is displayed like one
//metrix. Hoo Haa it is a well designed prog
}}
//**********************************FUNCTION OF DISPLAY**************************************************
//__________________________________fUNCTION STARTS HERE__________________________________________________
void displayMatrix(int a[][MaxCols])
{
int row, col;// THREE variables declared in the scope of this function not visible out side
//display loop starts here
for (row = 0; row < MaxRows; row ++)
{// Nested section of display loop starts here
for(col = 0; col < MaxCols; col ++)
{// output statement of the matrix
cout << a[row][col] << '\t';
}//.................................END OF FUNCTION.....................................................
cout << '\n';// ESCAPE FOR FORMATTING
}
}//**********************************************************************************************************
//___________________________________FLIP FUNCTION STARTS HERE____________________________________________
void displayFlippedMatrix(int a[][MaxCols])
{// VRAIABLE WITH LIMITED SCOPE BUT ONE GLOBAL VARIABLE
int row, col;
// FOR LOOP FOR FLIP STARTS HERE
for (row = MaxRows - 1; row >= 0; row --)
{
for(col = 0; col < MaxCols; col ++)
{
cout << a[row][col] << '\t';
}
cout << '\n';
// FOR LOOP ENDS HERE
}// END OF THE FUNCTION FLIPING MATRIX
//END OF THE PROGRAM avery well written program Hats off VU CS faculty God Bless
}