Could you please help me check as to where I am going wrong in the following code (also it would be nice if you could tell how to generate link for my code so next time I wont have to paste the whole thing ):
#include
using namespace std;
int main() {
long n,i=0;
cin>>n;
long long a[n],prev=0;
bool isinc=1,ans=0;
for(;i<n;i++){
cin>>a[i];
}
i=0;
while(i>n){
if(isinc){
if(prev>a[i])
isinc=0;
}
if(!isinc){
if(prev<a[i]){
cout<<“false”;
ans=1;
}
}
prev=a[i];
i++;
}
if(!ans){
cout<<“true”;
}
return 0;
}