Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Print the elements of a matrix traversing it spirally. More...
#include <iostream>
Functions | |
void | genArray (int **a, int r, int c) |
void | spiralPrint (int **a, int r, int c) |
int | main () |
Print the elements of a matrix traversing it spirally.
void genArray | ( | int ** | a, |
int | r, | ||
int | c ) |
Arrange sequence of numbers from '1' in a matrix form
[out] | a | matrix to fill |
[in] | r | number of rows |
[in] | c | number of columns |
int main | ( | void | ) |
main function
void spiralPrint | ( | int ** | a, |
int | r, | ||
int | c ) |
Traverse the matrix spirally and print the sequence of elements
[in] | a | matrix to read from |
[in] | r | number of rows |
[in] | c | number of columns |
Print start row
Print the end col
Print the end row
Print the start Col