Answered step by step
Verified Expert Solution
Question
1 Approved Answer
L 3 . 3 Write a subroutine to swap the first row of a matrix with the last row, the second row with the second
L Write a subroutine to swap the first row of a matrix with the last row, the second row with the secondtolast row, etc. The matrix is N by M and is stored in rowmajor order. The starting address of the matrix and the matrix dimensions N and M are passed to this routine in the stack in this order: matrix base address, N M that is the matrix base address is pushed onto the stack first, followed by N and M The matrix elements are bit. Write a main program to test this routine, including the following features:
Call the Buffalo IO routine OUTSTRG to output the message "The original matrix is as follows:" and call the routine OUTCRLF to move the screen cursor to the next line.
Call the Buffalo monitor IO routines OUTLHLF and OUTRHLF to output the matrix elements, one row per line. Elements should
be separated by one space. Call the matrix swap subroutine to swap the rows of the matrix.
Call the IO routine OUTSTRG to output the message The swapped matrix is as follows:" and call the routine OUTCRLF to move the screen cursor to the next line.
Call the Buffalo IO routines OUTLHLF and OUTRHLF to output the matrix elements, one row per line
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started