please do help me the program goes like this;

  #include<iostream.h>
  void main()

  {
      int x;
      int no[10];

          cout<<"input 10 numbers"<<endl;
      for(x=0;x<=9;x++)
          cin>>no[x];
      for(x=0;x<=9;x++)
          cout<<no[x]<<endl;
  }

but i have to get the sum 0f the 10 numbers in ascending order this the outtput example:

                        1+1=2
                        2+2=4
                        3+3=6
                        5+5=10
                        4+4=8

i have to switch the 10 and the 8 in order,
please help me.

Recommended Answers

All 2 Replies

Look up the "bubble-sort" algorithm and/or the "selection sort" algorithm. These are the easiest to understand sorting algorithms IMO.

Once you know the algorithms, implementing them will be easy. Good luck!

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.