how to develop a prog in cpp that asks the user to enter numbers and sort them ascendingly using arrays.

Recommended Answers

All 3 Replies

We don't do assignments for you. Show us your work so far, tell us what you're having trouble with, and then we'll be able to help.

what to do after accepting the numbers for eg. int main() { int number[20]; for(int i=0;i<20;i++) { cout<<"enter a number up to 20"<<endl; cin>>number[i];} what to do after this?

Please format code, something like this:

int main()
{
    int number[20];

    for(int i = 0; i < 20; i++)
    {
        cout << "enter a number up to 20" << endl;
        cin >> number[i];
    }
}

what to do after this?

I imagine you should...

sort them ascendingly using arrays.

So you have numbers in an array, number.

If this is an assignment, you shouldn't be completely unprepared; your instructor should have introduced you to at least one sorting algorithm before giving you this task.

Do you truly have no idea how to sort them? If not, that's okay--I'm just trying to figure out the best place to start.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.