Please provide correct code

The code is :-
#include
using namespace std;
void spiral (int a[][100], int m, int n)
{
int startRow=0;
int startCol=0;
int endRow=m-1;
int endCol=n-1;
while (startRow<=endRow and startCol<=endCol)
{
for (int i=startCol; i<=endCol; i++)
cout<<a[startRow][i]<<" “;
cout<<”,";
startRow++;
for (int i=startRow; i<=endRow; i++)
cout<<a[i][endCol]<<" “;
cout<<”,";
endCol–;
if (endRow>startRow)
{
for (int i=endCol; i>=startCol; i–)
cout<<a[endRow][i]<<" “;
cout<<”,";
endRow–;
}
if (endCol>startCol)
{
for (int i=endRow; i>=startRow; i–)
cout<<a[i][startCol]<<" “;
cout<<”,";
startCol++;
}
}
}
int main()
{
int m, n;
cin>>m>>n;
int a[100][100];
for (int i=0; i<m; i++)
{
for (int j=0; j<n; j++)
cin>>a[i][j];
}
spiral (a, m, n);
return 0;
}

The output this code is showing is:
1 2 3 4 5, 10 15 20, 19 18 17 16, 11 6, 7 8 9, 14, 12, 13

Whereas the output should have been:
1 2 3 4 5, 10 15 20, 19 18 17 16, 11 6, 7 8 9, 14, 13 12

Please check and provide the correct solution!

@Mac2503 plz provide the code using cb ide , its very difficult to look at it without indentation