http://softwareandfinance.com/Downloads_Sorting_Number.html 

 

#include <iostream>
#include <string>

// Program for ascending order of Numeric Values

int main()
{
    int max;
    std::cout << "\nProgram for Ascending order of Numeric Values";
    std::cout << "\n\nEnter the total number of elements: ";
    std::cin >> max;    
    std::cout << "\n

    int *numarray = new int[max];

    for(int i = 0; i < max; i++)
    {
        std::cout << "Enter [" << i + 1 << "] element: ";
        std::cin >> numarray[i];
    }

    for(int i = 0; i < max; i++)
    {
        for(int j = 0; j < max; j++)
        {
            if(numarray[i] < numarray[j])
            {
                int temp = numarray[i]; 
                numarray[i] = numarray[j];
                numarray[j] = temp;
            }
        }
    }

    std::cout << "\n\nThe numbers in ascending orders are given below:\n\n";

    for(int i = 0; i < max; i++)
    {
        std::cout << "Sorted [" << i + 1 << "] element: ";
        std::cout << numarray[i];
        std::cout << "\n";
    }
    delete [] numarray;
    return 0;
}

--- In [email protected], "Abdulrehman" <abdulrehmanam...@...> wrote:
>
> Hi! can any body write the C++
> code for a programme sorting 10 numbers plz!
>


Reply via email to