(
inti = 0; i < r; i++) {
15 for(
intj = 0; j < c; j++) {
17std::cout << a[i][j] <<
" ";
20std::cout << std::endl;
30 intstartRow = 0, endRow = r - 1;
31 intstartCol = 0, endCol = c - 1;
34 while(startRow <= endRow && startCol <= endCol) {
36 for(
inti = startCol; i <= endCol; i++, cnt++) {
37std::cout << a[startRow][i] <<
" ";
42 for(
inti = startRow; i <= endRow; i++, cnt++) {
43std::cout << a[i][endCol] <<
" ";
52 for(
inti = endCol; i >= startCol; i--, cnt++) {
53std::cout << a[endRow][i] <<
" ";
61 for(
inti = endRow; i >= startRow; i--, cnt++) {
62std::cout << a[i][startCol] <<
" ";
72 int**a =
new int*[r];
73 for(
inti = 0; i < r; i++) a[i] =
new int[c];
78 for(
inti = 0; i < r; i++)
delete[] a[i];
void spiralPrint(int **a, int r, int c)
void genArray(int **a, int r, int c)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4