#include
using namespace std;
void spiralprint(int a[][100],int n , int m){
int sc = 0;
int ec = m -1 ;
int sr = 0 ;
int er = n-1;
while(sr<er && sc<ec){
for (int i = sc; sc<ec ; i ++ ){
cout<<a[sr][i]<<", β;
}
sr++;
for (int j = sr ; sr<er ; j ++ ){
cout<<a[j][ec]<<β, β;
}
ecβ;
for (int k = ec ; k>sc ; k++){
cout<<a[er][k]<<β, β;
}
erβ;
if (sr<er){
for (int t = 0 ; t >sr ; t++){
cout<<a[t][sc]<<β, ";
sc++;
}
}
}
cout<<βENDβ;
}
int main() {
int n , m , x ;
cin >> n >> m ;
if (n < 1 || n > 10 || m < 1 || m > 10){
return -1;
}
int a[n][100];
for ( int i = 0 ; i < n ; i++ ){
for ( int j = 0 ; j < m ; j++ ){
cin>>x;
a[i][j] = x;
}
}
spiralprint(a,n,m);
return 0;
}
How can I fix this error?