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.

Salem commented: OK, now you just passed from irritant to impatient spammer -7

Recommended Answers

All 4 Replies

I don't see any code there that is adding numbers? Just input and output... Also, please use code tags.

Additionally, once you get the sum of the numbers, perform any sorting technique(bubble sort, selection sort, etc.) on it.

You have already started a thread with the exact same name as this one where people are trying to assist you:

http://www.daniweb.com/forums/thread223471.html

Why did you start a new one? If you are done with the old one, mark it as solved so that you don't have users continuing to post to that one. Also, you have been asked by a lot of the members to start using code tags (if you don't know how to use them, ask and someone will assist you) which you have still neglected to do.

If you follow the forum rules and guidelines, you will get the help you need.

-D

How to sort using std

int Array[4] = {4,2,2,1};
std::sort(Array,Array+4); //now array is {1,2,3,4};
for(int i  = 0; i < 4; i++) Array[i] *=2; //now array is {1,4,6,8};
//print out the array.
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.