I am trying to input int array size and then get N space-separated integers as shown below:
int main()
{
int N;
cin>>N;
int *arr = new int(N);
for(int i=0; i<N; i++) {
cin>>arr[i];
}
for(int i=0; i<N; i++) {
cout<<arr[i]<<endl;
}
if (isSpiralSorted(arr, N))
cout << "yes" << endl;
else
cout << "no" << endl;
return 0;
}
but the input:
10
1 2 3 4 5 6 7 8 9 10
actually takes:
2 3 4 5 6 7 8 9 10
Can someone help me here in understanding what am I doing wrong?