I would do something simple like this
int a[150], i, n, pos;
bool valid = true;
scanf("%d",&n);
for(i=0; i<n; i++) {
scanf("%d",&a[i]);
}
for(pos=1; pos<n; pos++) {
if (a[pos] >= a[pos-1]) {
break;
}
}
//printf("pos after decreasing part:%d\n", pos);
pos += 1;
while (pos < n) {
// printf ("loop increase %d < %d?, pos=%d\n", a[pos-1], a[pos], pos);
if (a[pos] <= a[pos-1]) {
valid = false;
break;
}
pos += 1;
}
//printf("pos after increasing part:%d\n", pos);
if(valid) {
Surely this could be done more elegant and more efficiently, but I do not have much experience in C++. Luckily, I do not have to solve this problem.