A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/db/d07/spiral__print_8cpp_source.html below:

TheAlgorithms/C++: others/spiral_print.cpp Source File

Go to the documentation of this file. 14 for

(

int

i = 0; i < r; i++) {

15 for

(

int

j = 0; j < c; j++) {

17

std::cout << a[i][j] <<

" "

;

20

std::cout << std::endl;

30 int

startRow = 0, endRow = r - 1;

31 int

startCol = 0, endCol = c - 1;

34 while

(startRow <= endRow && startCol <= endCol) {

36 for

(

int

i = startCol; i <= endCol; i++, cnt++) {

37

std::cout << a[startRow][i] <<

" "

;

42 for

(

int

i = startRow; i <= endRow; i++, cnt++) {

43

std::cout << a[i][endCol] <<

" "

;

52 for

(

int

i = endCol; i >= startCol; i--, cnt++) {

53

std::cout << a[endRow][i] <<

" "

;

61 for

(

int

i = endRow; i >= startRow; i--, cnt++) {

62

std::cout << a[i][startCol] <<

" "

;

72 int

**a =

new int

*[r];

73 for

(

int

i = 0; i < r; i++) a[i] =

new int

[c];

78 for

(

int

i = 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