Ascending numbers

I want to make a program which should read a number n, which describes, how much numbers are goig to be read by the computer.
Those n numbers have to be read in the next line. If the order of those numbers is ascendent (so, the second is greater than the first and so on), YES should be cout and if not every number increases the left one NO.
My program:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
int main(){
    int indicadoresCantidad;
    int max;
    int paso=1;
    while(1){
        std::cin>>indicadoresCantidad;
        if(indicadoresCantidad==0){
            return 0;
        }else{
            int indicador[indicadoresCantidad];
            for(int n=1;n<indicadoresCantidad+1;n++){
                std::cin>>indicador[n];
            }
            for(int b=1;b<indicadoresCantidad+1;b++){
                if(indicador[b]>max){
                indicador[b]=max;
                paso++;
                }
            }
            if(paso!=indicadoresCantidad+1){
                std::cout<<"NO"<<"\n";
            }
            else if(paso==indicadoresCantidad+1){
                std::cout<<"SI"<<"\n";
            }
            paso=0;
            for(int y=0;y<indicadoresCantidad;y++){
                indicador[y]=0;
            }
            
        }
    }
    
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>

int main()
{
    int n;
    std::cin >> n;

    int a;
    if (n-- > 0) std::cin >> a;

    bool good = true;

    while (good && n-- > 0)
    {
        int b = a;
        std::cin >> a;
        if (a <= b) good = false;
    }

    std::cout << (good ? "YES\n" : "NO\n");
}

Topic archived. No new replies allowed.