Answered step by step
Verified Expert Solution
Link Copied!

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

L3.3 Write a subroutine to swap the first row of a matrix with the last row, the second row with the second-to-last row, etc. The matrix is N by M and is stored in row-major 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 8-bit. Write a main program to test this routine, including the following features:
1. Call the Buffalo I/O 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.
2. Call the Buffalo monitor I/O routines OUTLHLF and OUTRHLF to output the matrix elements, one row per line. Elements should
be separated by one space. 3. Call the matrix swap subroutine to swap the rows of the matrix.
4. Call the I/O 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.
5. Call the Buffalo I/O 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

Students also viewed these Databases questions

Question

Describe how to train managers to coach employees. page 422

Answered: 1 week ago