Exemplo n.º 1
0
int main() {

    freopen(FIN, "r", stdin);

    scanf("%d\n",&N); 

    gets( str );

    str[strlen(str)] = ' ';

    int j = 0;

    for(int i = 0; i < N; i++) {

        int num = 0;
         
        while(str[ j ] != ' ') {

              num = num * 10 + str[ j ] - '0';

              j++;
        }

        vec.push(num);

        j++;
    }  

    fclose( stdin );

    qsort(0, N - 1);

    std::ofstream fout( FOUT );

    for(auto const el: vec) {

        fout<<el<<" ";
    }

    fout.close();
 
  return(0); 
};
Exemplo n.º 2
0
int main() {

    freopen(FIN, "r", stdin);

    scanf("%d\n",&N); 

    for(int i = 0, elem; i < N; ++i) scanf("%d", &elem), vec.push( elem );

    fclose( stdin );

    qsort(0, N - 1);

    std::ofstream fout( FOUT );

    for(std::vector<uint>::iterator it = vec.begin(); it != vec.end(); ++it) fout<<*it<<" "; 

    fout.close();
 
  return(0); 
};